I really struggled with that for YEARS. I just could not do it. About 8 years ago I just forced myself to do it, and kept at it, then suddenly, like a switch, it was super easy and now pretty much any song, if I know how it goes, I can strum and sing
Practice.
I don't know how much my ears can handle