During one of his visits to the temple, he went to check on Mary, who was living in a secluded room of the temple. He was surprised to find fresh out-of-season fruit in her room. Besides him, no one had entry to her room. When he inquired, she told him that the fruit was from Allah. She found it every morning. But why was he so surprised, she asked him. Did he not know that Allah provides without measure for whom He wills?
This noble girl had opened his eyes to a startling idea. Could he not ask his Lord to bless him with a child in his old age? Even if his wife was past child-bearing age, nothing was impossible for his Gracious Lord!
Related Quran Ayaaths of this Hadith.
"When a person dies, his works end, except for three: ongoing charity, knowledge that is benefited from, and a righteous child who prays for him."
Prophet Mohammed (PBUH)
"The best of what a man leaves behind are three: a righteous child who supplicates for him, ongoing charity the reward of which reaches him, and knowledge that is acted upon after him."
Sunan Ibn Mājah
"Every day two angels come down from Heaven and one of them says, 'O Allah! Compensate every person who spends in Your Cause,' and the other (angel) says, 'O Allah! Destroy every miser.'"
Sahih Bukhari