In the final book of the Mahabharata, the Pandavas are making their ascent to Swarg ka Dwar (heavens door). They are accompanied by a dog on the journey. One by one the brothers begin to die, and in the end it is only Yudhisthira and the dog who make it to Indra’s Chariot.
However, Indra announces that the dog cannot enter heaven, it is lowly and has no value.
Upon hearing this, Yudhisthira refuses and turns away, telling Indra that if the dog, who had not left his side as all his brothers fell around him, was not able to enter heaven, than heavan was no place for him.
Indra is pleased and duly stops Yudhisthira. The dog was actually his dharma, and thus Indra said
“If a man likes dogs He is a good man,
If a dog likes man He is a good man”
And both the dog and Yudhisthira were allowed to enter heaven.