إِذَا مَاتَ الْإِنْسَانُ انْقَطَعَ عَنْهُ عَمَلُهُ إِلَّا مِنْ ثَلَاثَةٍ
When a person dies, their actions cease except through three continuing sources.
Ṣadaqah jāriyah — ongoing charity whose benefit continues.
ʿIlm yuntafaʿu bih — beneficial knowledge that people continue to use.
Walad ṣāliḥ yadʿū lah — a righteous child who prays for them. (Ṣaḥīḥ Muslim, Book of Bequests)
These are forms of benefit that continue after death. The benefit of the righteous child's prayer is specifically mentioned.