The Impact of Good Deeds on Children
Allah Almighty said:
“As for the wall, it belongs to two orphaned boys from the city. Under it is their treasure. Their father was righteous“
[Quran 18:82]
Ibn Kathir said in his interpretation of this verse:
As for the word of Allah: “and their father was righteous” – this is proof that the righteousness of a person is the reason for the preservation of his offspring because of the grace of his worship in this life, as well as in eternal life because of his intercession for them. and also the reason for the elevation of their degrees in the highest paradise, so that he would rejoice in them, as it is said in the Qur’an and in the Sunnah. Said ibn Jubair narrates that Ibn Abbas said: “Allah cared for them because of the righteousness of their ancestor. And this was a great-grandfather in the seventh generation. “
Allah knows best.
See “Tafsiru-l Kurani-l-Azim” 3/94 ibn Kathir.