Since the influence of friend of man is very deep, Islamic teachings have given an important status to the friendship. In Holy Quran it is stated that most of the companions of the Fire will say, in the Hell, that
“Oh, woe to me! I wish I had not taken that one as a friend. He led me away from the remembrance after it had come to me. And ever is Satan, to man, a deserter.”
So it is very important to know how your friend is.
In this regard, there is a very nice hadith in which Imam Baqir (AS) said:
My father Ali Ibn al- Hussein (AS), once, advised me: ‘O son, do not associate, talk, or accompany five classes of people.’ ‘Who are they, father?’ asked me, and he (AS) answered: ‘Beware of associating with the liar, for he is as same as a mirage: he shows you the near as remote, and shows you the remote as near. Beware of associating with the sinful, for he will disappoint you for a single bite or even something less valuable. Beware of associating with the stingy, for he will let you down when you are in urgent need of his property. Beware of associating the foolish, for he harms you when he intends to do you favor. Beware of associating with the disregardful of his relatives, for I found him cursed in the Book of Allah.