Someone told me that atheists could be saved if they acted charitably, but I said that apart from God’s saving works, man cannot save himself.
While you are correct that man cannot save himself, God can choose to save someone who is unable in conscience to believe God exists but lives as best he can according to the knowledge he does have. Gaudium et Spes states about atheism:
Undeniably, those who willfully shut out God from their hearts and try to dodge religious questions are not following the dictates of their consciences, and hence are not free of blame; yet believers themselves frequently bear some responsibility for this situation . . . To the extent that they [believers] neglect their own training in the faith, or teach erroneous doctrine, or are deficient in their religious, moral, or social life, they must be said to conceal rather than reveal the authentic face of God and religion. (19)
This implies that the culpability for atheism is not necessarily entirely the individual’s. To the extent that belief in God has been made impossible for him by others, there may be some mitigation of his culpability for unbelief. Ultimately we must trust that even he is not beyond the reach of God’s mercy if he strives to live morally (cf. Lumen Gentium 16). The second great commandment is love of neighbor (Matt. 22:39) and Christ said of those who serve others, even if they do not explicitly do it for Christ’s sake:
Then the righteous will answer him, "Lord, when did we see thee hungry and feed thee, or thirsty and give thee drink? And when did we see thee a stranger and welcome thee, or naked and clothe thee? And when did we see thee sick or in prison and visit thee?" And the King will answer them, "Truly, I say to you, as you did it to one of the least of these my brethren, you did it to me" (Matt. 25:37-40).