Once Hakeem Jalinoos requested some of his friends to bring a certain medicine from the chemist. The friends told him: "That is a medicine which is given to mad people to drink. What is wrong with you that you now ask for medicine for madness?"
"A mad one stared at me.
For a whole hour that mad one looked at me and was very pleased
Then he winked his eyes and tore his sleeve to pieces.
If I was not of his nature and temperament and if I had no madness in me,
Then why would this ugly one continue to stare at me?
When does a bird fly except with other birds of the same feather?
The company of a contrasting kind, is like a live one in a grave".
Jalinoos said that when a specific attribute becomes a common factor in two different people, then it becomes a cause for mutual friendship and compatibility.
The friends were quite surprised at this knowledge. They then tried to find out what was the common attribute between Jalinoos and the mad man. When the friends went close to the mad one, they were astonished to note that he too walked with a limp, like Jalinoos.
In other words, this was the common attribute which caused the compatibility between them.
Lesson from this Story
If a person meets a bad person and gets pleased or, a bad person who has no intention of giving up his evil habits, meets him and becomes pleased, then know that some evil in both is the common factor, that has created this pleasure.
Experience has shown that if a person is considered to be pious because of his outward appearance however his association and company and friendship is all the time with the evil doers and materially inclined, then in reality he too is a worldly one and materially inclined, although his outward appearance is that of piety. If he is meeting the evil doers in order that he may invite them towards righteousness then that is an exception.
This is also supported by the Hadith "Every person is on the Deen (way of Life) of his close friend". So if you wish to know about any person's character, then see who his very close friends are. It is also proven that a person greedy for wealth but unable to acquire it, listens greedily to stories of the rich and their wealth. On the other hand a person desirous of the deeds that gain one eternal happiness, but unable to achieve them due to weakness, still listens greedily to stories of people who achieved spiritual perfection and proximity to Allah Taala and Rasululah.