Umar bin Khattab reported,

Then the Prophet ﷺ gave the order, and they were cast into a well. He went to them and called out, "So-and-so, son of so-and-so, so-and-so, son of so-and-so, have you found what Allah and His Messenger promised you to be true? For I have indeed found what Allah promised me to be true."I said, "Messenger of Allah, how can you speak to bodies that have no souls in them?"He replied, "You do not hear what I say better than they do, except that they are unable to give me any reply."

Azami 3830

Sahih

عن عمر بن الخطاب قال

ثم أمر النبي ﷺ فطرحوا في بئر، فانطلق إليهم فقال: يا فلان بن فلان يا فلان بن فلان، هل وجدتم ما وعدكم الله ورسوله حقا؟ فإني قد وجدت ما وعدني الله حقا قلت: يا رسول الله! كيف تكلم أجسادا لا أرواح فيها؟ قال: ما أنتم بأسمع لما أقول منهم، غير أنهم لا يستطيعون أن يردوا علي شيئا.

الأعظمي 3830صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Funerals
Chapter
Conditions of the deceased in the grave
Section
Hearing of the dead
Numbering
Jami al-Kamil 3830 (2nd edition)
Azami 3830