It's obviously not impossible, but it's also obviously less likely. The proof is in the pudding.
It also sort of depends on what you what to convey. I'm not a black male, so I, for example, would never try to capture the struggle of black males in society in a product I'm producing, if only because I'm sure it'd come off as non-authentic. Simply put, I don't have the life experiences necessary to tell a black man's tale with any level of authority. It places a limit on the kind of character I can create, even if making a story about african american struggle would be interesting to me.
Question about the bolded: Could you write a character whose profession is dramatically different from your own? Could you write an action hero despite (presumably) never having been in any gunfights, escaped an exploding building, or hijacked a helicopter?
What I'm getting at is that writing a character with a particular background doesn't necessarily demand that every conceivable detail be 100% authentic and authoritative. There are plenty of cases where the only real requirements are that the character be somewhat believable and not blatantly offensive. The nature of the story will dictate how in-depth various aspects of a character need to be.
Also, it's not like there aren't any options: If I was trying to write a gay character and ran into difficulty with something, I'd ask one of my gay friends. In the case of writing a female character, asking for advice from a woman is even easier.