These four, young householder, should be understood as warm-hearted friends:
• the helper,
• the friend who endures in good times and bad,
• the mentor, and
• the compassionate friend.
The helper can be identified by four things: protecting you when you are vulnerable, and likewise your wealth, being a refuge when you are in danger, and when there are commitments he provides you with double the supply needed.
The enduring friend can be identified by four things: revealing his secrets to you, guarding your own secrets closely, not abandoning you in misfortune, and even dying for you.
The mentor can be identified by four things: restraining you from wrongdoing, guiding you towards good actions, telling you what you ought to know, and showing you the path to heaven.
The compassionate friend can be identified by four things: not rejoicing in your misfortune, delighting in your good fortune, preventing others from speaking ill of you, and encouraging others who praise your good qualities.
Siṅgāla Sutta, Dīgha Nikāya 31
Should you find a man who points out faults and who reproves, follow such a wise and sagacious person as you would a guide to a hidden treasure. It is always better, and never worse, to cultivate such an association.
Let him admonish, instruct and shield you from wrong; he, indeed, is dear to the good and detestable to the evil.
Do not associate with evil companions; do not seek the fellowship of the vile. Associate with the good friends; seek the fellowship of noble men.
Dhammapada (v. 76–78)