In his autobiography "Where's the Rest of Me?", Ronald Reagan wrote that he attempted to persuade director Peter Godfrey to have the ending rewritten, arguing that audiences wouldn't approve of a romantic pairing between Reagan and the 17-years-younger Shirley Temple. According to Reagan, Godfrey pointed out that his own wife, Renee Godfrey, was 20 years younger than himself, and Reagan decided it would be unwise to press the matter.
https://www.imdb.com/title/tt0039892/trivia?ref_=tt_trv_trv