The best way to cheer yourself is to try to cheer somebody else up.
Mark Twain (1835-1910) American writer [pseud. of Samuel Clemens]
Note (1896-11-26), Mark Twain’s Notebook, ch. 27 “England” (1935) [ed. Albert Bigelow Paine]
(Source)
Written while in Guilford, England, shortly after the death of his daughter Susy in America.
Often given as "The best way to cheer yourself up is to try to cheer somebody else up." More discussion here.