Sayyiduna Qurrah bin Iyas (may Allah be pleased with him) said: It was the practice of the Prophet (peace and blessings be upon him) that whenever he (peace and blessings be upon him) sat, a group of his (peace and blessings be upon him) Companions would sit with him (peace and blessings be upon him). Among them was a man who had a little son; the boy would come from behind him and sit in front of him. Then the boy died, and out of grief the man stopped attending the gathering of the remembrance of Allah and remained sorrowful over him. The Prophet (peace and blessings be upon him) missed him and said: "Why do I not see so-and-so?" The people said: O Messenger of Allah! That son of his whom you saw has died; that is why he is not attending the gathering. So the Prophet (peace and blessings be upon him) met him and asked him about him (the boy), and he was told that he had died. He (peace and blessings be upon him) offered him condolences, then said: "O so-and-so! Which of the two would you prefer: that you enjoyed him for the rest of your life, or that tomorrow, whichever gate of Paradise you come to, you find him already there ahead of you, opening the gate for you?" He said: O Prophet of Allah! Rather, that he reaches the gates of Paradise before me and opens them for me; that is dearer to me. He (peace and blessings be upon him) said: "Then that is yours." Then a man from the Ansar stood up and said: O Messenger of Allah! May Allah make me your ransom, is this specific to so-and-so alone, or is it the same for any Muslim whose child dies having gone ahead (to Paradise)? He (peace and blessings be upon him) said: "Rather, it is the same for every Muslim whose child has died having gone ahead."
Hadith Referenceالمعجم الكبير للطبراني / باب القاف / 16116