Insight Meditation teacher Sharon Salzburg relates a classic Buddhist teaching story this way:
The monk Ananda observed: “It seems to me, oh Lord Buddha, that half of the holy life is having good friends.
The Buddha replied: “Not so, Ananda! In fact, the whole of the holy life is having good friends.”
So what does the Buddha really mean by "good friend"? Here's my hands-down, all-time favorite commentary on the topic, from assorted sutras via the Burmese Buddhist monk U Jotalankara:
These are the four types that can be seen to be good or true friends. They are, in order: 1. one who is helpful, 2. one who is the same in happy and unhappy times, 3. one who points out what is good for you, and 4. one who is sympathetic.
The first good friend, who is helpful, has four characteristics: (1) looking for you when you are drunk, (2) looking for your possessions when you are drunk, (3) being a refuge for you when you are in trouble, and (4) leting you have twice what you ask for when some business is to be done.
The second good friend, who is the same in happy and unhappy times, has four characteristics: (1) telling you his secrets, (2) keeping your secrets, (3) not forsaking you when you are in trouble, and (4) sacrificing even his life for you.
The third good friend, who points out what is good for you, has four characteristics: (1) keeping you from wrongdoing, (2) supporting you in doing good, (3) informing you of what you do not know, and (4) pointing out the path to heaven.
The fourth good friend, who is sympathetic, has four characteristics: (1) not rejoicing at your misfortune, (2) rejoicing at your good fortune, (3) stopping others who speak against you, and (4) commending others who speak in praise of you.
Now I think "sacrificing even his life" is a bit much--but "looking for your possessions when you are drunk" may be the most endearing friend-quality I've ever heard about. And "pointing out the path to heaven" is not bad either!
The above is just an excerpt, so if you'd like to know yet more about the Buddhist perspective on good and bad friends, read the whole commentary--it's not long.. (Spoiler: Bad friends are those who among other things take all your stuff, lie to you, and keep you company when "haunting the streets at unfitting times.")