Grab a pen and paper and try to write down the names of all your friends, and then classify them into categories. You will discover that some of them are not really friends but rather casual companions.
One of them may be your fellow commuter whom you meet every day on the bus or tram. He greets you, so you greet him, and he asks you a question, so you answer him. He requests that you close the window, and if you do, he thanks you, or he steps on your foot and, if he realizes it, he apologizes. A word leads to a smile, and a smile leads to a chat, and as the days pass, you find yourselves exchanging greetings and talking to each other as if you were close friends, although you may not even know his name nor have any clue about what he really is!
Another one on your list is the work colleague. You may be an employee, and his office is opposite to yours, and you see him all day long. You may be a worker, and his machine is right next to yours. Or he may be working with you in the same store, or his store is next to yours in the marketplace. You spend more time with him than with your own family, and you meet with him more often than you meet with your friends and loved ones! You may share moments of seriousness, humor, contentment, and anger with him, while the two of you have totally different appearances, minds, and backgrounds.
You may also find on the list a traveling companion whom you meet on a train and share the desire to ward off boredom. You exchange greetings and small talk, or make some observations on what you see and hear during the journey. Within a few hours, you share food and you fall asleep in the same space. The barriers between you start to fall and you see and know about one another what only your household members or close relatives would see or know about you, although you are totally unrelated and you have no brotherly affection for each other.
There is also the coffee house companion, the sports companion, and many other different categories of companions. Your relationship with some of them might last for long until you start calling them ‘friends’, but they are not friends. You neither picked them willingly to be your friends nor chose their companionship, but life put them in your way and burdened you with them. If you do not conduct an inventory of them the way a merchant conducts an inventory of his merchandise then you vet them and only keep the good ones and cast away the bad ones, you would not know down which abyss such friendships lead you. A companion drags his companions down the path he is treading, and they tend to follow his example.
You may accompany a person down a path or a journey or know him from work and interact with him friendly as courteously as a well-mannered person should interact with others while being unaware of his life. He would become associated with you, and he becomes known as your “friend,” and his evils would affect you accordingly. You may be harmed by such association, and he may become a source of disgrace to you. He may also influence you in a way you are unaware of. Every word you hear can be likened to a seed thrown into a fertile land; it may be a good seed that generates goodness within you, or an evil one that gives rise to evil within you. Many righteous people were corrupted because they kept the company of a wicked person who changed their state drastically and made life misery for them. Conversely, many wicked people were rectified and became righteous because they kept the company of the righteous. A person may be safe from his sinful urges on his own and distract himself from them with knowledge or art, or practicing spiritual or physical exercise, but a wicked companion may come along, out of the blue, to trigger such sinful urges within him and cause him to taste their bitterness.
Another may be living a sinful life leading him ultimately to Hellfire, but he would be blessed with a righteous friend who would steer him away and lead him towards Paradise instead. A friend who reminds you of Allah is not like the one who causes you to forget His remembrance. A friend who leads you to the mosque for worship is not like the one who leads you to a brothel to commit sin. A friend who tells you about a book that he read and encourages you to read it as well is not like the one who describes the beauty of a female dancer that he had watched to incite you to watch her too.
If you seek a friendship that fosters your righteousness and a deed that rectifies all deeds, then write down the names of your friends, companions, and acquaintances with whom you are on friendly terms, and investigate the state of each and every one of them: is he righteous or unrighteous? Is he loyal to his friends, or does he only care about what benefits and pleases him? Is he a source of comforting company, or is he rough and annoying? If you do so, you will find that your companions are indeed different. You will find among them the one who is devoted to fasting and prayer and has the outward appearance of the righteous but is actually using this ‘outward righteousness’ as a ladder to rise in the world and a trap to catch money thereby. You will find out that his true character belies his false pretense of piety. If you make a covenant with him, he betrays you, and if you enter into a transaction with him, he cheats you.
You will also find the one who is honest and trustworthy, but he does not observe fasting nor prayer and is a Muslim in name only. Such a companion will ruin your religiosity.
You will find among them the one who is a righteous, devout worshiper, who is trustworthy and honest, but he has an insatiable lust and unbridled urges, and he talks about nothing else. He refrains from committing sins but indulges in speaking about them! Such a person harms you by arousing your dormant desires and waking the latent urges inside you.
There is also the one who is righteous and trustworthy and guards his tongue but is not friend-material, nor is he an enjoyable companion. If he were on the banks of the Euphrates while you are burning with thirst, he would not hand you a glass of water!
Another is the one who is willing to help and please his friends but would not mind compromising his own religion in the process. He may betray the trusts and undermine his honor for the sake of his friends, helping them commit sins, devour people’s rights, and steal their wealth. He perceives such compromise acceptable and allowable for the sake of friendship! Such a companion takes your hand until he leads you to Hellfire with him!
Another companion may be pious, helpful to his friends, and complying with the Limits of Allah. He does not commit sins nor engage in forbidden acts, but he is ignorant of the proper etiquettes of social interactions, table manners, and all the common norms of decorum. Such a person would disgust you and get on your nerves.
There is also the foolish and vulgar, or the reckless and foul, or the one who befriends you for your prestige or high position. He uses you as an adornment for today and an asset for tomorrow. To him, you are a trophy on the wall!
In brief, we can say that there are five different categories of companions: 1) a companion who is like the air; you cannot dispense with him, 2) a companion who is like food; you cannot live without him, but it may taste bad or be difficult to digest, 3) a companion who is like a medicine that tastes bitter but sometimes is necessary, 4) a companion who is like wine; it delights the one who drinks it but ruins his health and honor, and 5) a companion who is like a calamity that befalls you.
As for the companion who is like air, it is he who benefits you with regard to your religion and worldly life. You enjoy his friendship, and you find delight in his company.
The companion who is like food is he who benefits you with regard to your worldly life and religion but sometimes annoys you due to his roughness, lack of a sense of humor, and harsh nature.
As for the companion who is like medicine that tastes bitter, he is the one whom you may need and benefit of, but you do not approve of his religiosity nor enjoy his company.
The one who is like wine is he who helps you satisfy your pleasures and gratify your desires, but he corrupts your moral character and incurs loss on you in the Hereafter.
Finally, the companion who is like a calamity is he who does not benefit you with regard to your worldly life or religion, nor do you enjoy his companionship or conversation, but you inevitably have to keep his company.
You should take religion as a standard, and the pleasure of Allah as a scale. The one who benefits you with regard to your religion, hold on to him, unless you cannot endure his companionship. The one who harms you in this regard, cut him off and forsake him, unless you are compelled to keep his company. In this case, such companionship is considered a necessity, and necessities overrule prohibitions (i.e. permit what is normally forbidden), provided that such company does not exceed the scope of necessity.
As for the one who does not harm you with regard to your religion nor benefit you with regard to your worldly life, but he is a pleasant and enjoyable person to be around, you should settle for enjoying his pleasant personality provided that such companionship does not prevent you from carrying out your duties or lead you to futility or sin.
As for the companions who cannot be classified under any of these categories, they are the ones about whom an Arab poet said (translation of meaning):
“If you do not have knowledge to benefit us, nor are you religious that we may keep your company for that sake, and you are not one expected to help when disaster strikes, it would be better if we mold a clay figure to replace you!” - islamweb.net