What is the proof that the dead may benefit from a charity?
The saying of the Prophet, salallallahu ^alayhi wa sallam, “When the [Muslim] son of Adam dies, his deeds stop except for three, a continuing charity, a benefiting knowledge, and a pious offspring making supplication to Allah for him.” (Related by Muslim.) This hadith means that the Muslim will continue to benefit from some of his deeds after his death.
In Suratun-Najm, Ayah 39 means, “Mankind will be rewarded for the good deeds they acquired.” This Ayah and the previous hadith both indicate that one benefits from his own good deeds, and by the Grace of Allah one can also benefit from the good deeds others do for him. Such is when the dead Muslim benefits from the funeral prayer, even though it is not his own doing. Similarly, one will also benefit from the supplication of the Prophet, salallallahu ^alayhi wa sallam, for him, even though it is not an act that he did.
An example is the supplication the Prophet made for Ibn Abbas, “O Allah teach him the knowledge of Hadith and the explanation of the Qur’an.” (Related by Al-Bukhariyy and Ibn Majah.)