Jane Austen said this quote

...when pain is over, the remembrance of it often becomes a pleasure.