The Bodhisatta was once a king’s advisor. When his other advisors slandered someone who the king considered a good man, the king asked the Bodhisatta how to tell if somebody is friend or foe. He answered that foes do not greet you politely, they honor your enemies and despise your friends, they neither share secrets with you nor keep yours in confidence, they never praise you, they rejoice in your misfortune, they don’t share good things with you, and they don’t pity you when you’re suffering misfortune. Then he explained that friends do the opposite of all these things. The king was delighted by this explanation and gave the Bodhisatta high praise.
In the Lifetime of the Buddha
The king showed great honor to a courtier who was very helpful, and this made some others jealous, so they falsely accused the courtier of doing bad things. The king looked into the matter and found no fault with the courtier. Unsure how to tell if somebody was friend or foe, the king went to ask the Buddha. The Buddha said the king had pondered this very problem in the past, and he told this story as his answer.
The king of the past was an earlier birth of Ananda, one of the Buddha’s top disciples.