Usamah bin Zaid (May Allah be pleased with them) narrated:
The daughter of the Prophet (ﷺ) sent for him as her child was dying, but the Prophet (ﷺ) returned the messenger and sent her good wishes saying, "Whatever Allah takes away or gives, belongs to Him, and everything with Him has a limited fixed term (in this world), and so she should be patient and anticipate Allah's reward." She again sent for him adjuring him for the sake of Allah to come. The Messenger of Allah, accompanied with Sa'd bin 'Ubadah, Mu'adh bin Jabal, Ubayy bin Ka'b, Zaid bin Thabit and some other men went to see her. The child was lifted up to the Messenger of Allah while his breath was disturbed in his chest. On seeing that, the eyes of the Prophet (ﷺ) streamed with tears. Sa'd said, "O Messenger of Allah! What is this?" He replied, "It is compassion which Allah has placed in the hearts of His slaves, Allah is Compassionate only to those among His slaves who are compassionate (to others)".Another version says: Messenger of Allah (ﷺ) said, "Allah shows compassion only to those among His slaves who are compassionate".[Al-Bukhari and Muslim].
Arabic/English book reference: Book 1, Hadith 29