Good upbringing is a cause of elevation in this world and the Hereafter
Just as the good upbringing of children becomes a cause of good reputation, honour and elevation in this world and a means of peace and comfort, so too it will become an ongoing charity after death, and this (that is, the good upbringing of children) will become a cause of elevation in ranks and of salvation for the parents, if Allah wills.
Abu Hurayrah (may Allah be pleased with him) said that the Messenger of Allah ﷺ said:
◈ إذا مات الإنسان انقطع عنه عمله إلا من ثلاثة صدقة جارية أو علم ينتفع به أو ولد صالح يدعو له
When a person dies, all his deeds come to an end except three: ➊ an ongoing charity, ➋ knowledge from which people benefit and gain, ➌ a righteous child who prays for him.
From this we learn that some deeds continue even after a person’s death, for example: an ongoing charity, such as when a madrasa, a mosque or a well is built, then as long as people keep benefiting from it, Allah keeps granting reward to the deceased. In the same way, if one leaves behind a store of knowledge in the form of books or students, he will keep receiving reward continually as long as people keep benefiting from it. Likewise, with righteous children whom a person has raised well, whenever the children perform any righteous deed, the parents will also keep receiving its reward. In another hadith, the Messenger of Allah ﷺ said:
◈ إن الرجل لترفع درجته فى الجنة. فيقول : أنى هذا؟ فيقال : باستغفار ولدك لك
“When a person’s ranks with Allah are raised, he asks: ‘O my Lord, what is the reason for the elevation of my rank?’ The answer comes: ‘Your children, who pray for forgiveness for you after your death.'”