For this reason...
For this reason, it is recommended to assess the character of a potential friend before you allow yourself to become too close and emotion overrides logic. We read in many books that a common problem amongst teenagers and youth today is that of Peer pressure. This just means the influence that your age-mates have over you. Hundreds of young people adopt vices like drugs, alcohol, smoking etc. only because their friends tell them it is 'cool' to do so.
They want to fit in and feel pressured into joining the majority. By the time they want to stop, they may have wasted years of their life or worse it may be too late to break free of the habit. Islam deals with this by instructing a youth to be aware of who is and why he exists. Once a young person realizes that his aim in life is to gain the pleasure of Allah (S.W.T.) then the groups and gangs hold no attraction for him and he does not feel the need to be accepted them.
In addition to this, he will avoid them because he knows that Islam recommends friends of good morals and character and people with such vices do not make good constructive friends.
The emphasis on the quality of the friend you choose is so great that although isolation is not a pleasing state, many ahadith of our Prophet (s.a.w.w.) and Aimmah (a.s.) tell us that in the event of being unable to find a moral friend, one should choose to maintain solitude rather than keep the company of immoral individuals. First Test then Trust Friendships built hastily on first impressions can easily collapse at the first sign of problems.
Make sure that you first get to know the person you want to befriend before trusting him otherwise you may find that the secrets you share with him are exposed to the world. Talking with people, seeing how they react in different circumstance, how well they associate with others all helps you to assess their character.
It has been mentioned in ahadith that if you observe that a person has reason to be angry and maintains his composure at such a time, doing this on three separate occasions then he deserves to be a friend. Of course this is only one admirable quality and friendship must be based on others in addition to this. Imam Ali (a.s.) has said: "Whoever chooses his friend after knowing him will be able to continue the friendship (i.e. it will last)" I.