The Bodhisatta was once a king’s advisor. When the other advisors slandered someone who the king considered a good man, the king asked the Bodhisatta how to tell if someone is a 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 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 him of doing bad things. The king looked into the matter and found no fault in the courtier. Unsure how to tell if he was friend or foe, the king went to ask the Buddha. The Buddha said he had pondered this very problem in the past and told this story as his answer.
The king of the past was an earlier birth of Ananda, one of the Buddha’s top disciples.