I have, personally, always found the whole “I just can’t write a character of a different gender!” argument a little silly.
There is little that truly separates men, women, and nonbinary people. The difference between someone who identifies as a man and someone who identifies as a woman can be minute compared to the difference between two men or two women, as the real variation in humans comes not from one’s gender but from one’s individual self. No two women are the same, just as no two men or two nonbinary people are the same.
Saying you cannot write someone of a different gender than yourself is like saying you cannot write any character beyond one you yourself closely identify with. If a writer is capable of writing a cast of characters that each have their own personality, said writer should be equally capable of writing characters of different genders with the same amount of variety. If they cannot, if they can only write characters of one gender, well… The issue goes beyond writing.
To be less vague and get more into the actual issue, in many cases male writers who poorly write female character have trouble seeing women as complex human beings. They know, consciously or not, the stereotypes they’ve been exposed to, and they struggle to break free of that pattern of thinking. They write women who are mere archetypes and little else, but that is really all that female character needs to be for their plot as it revolves almost entirely around male charactes — who may also be lacking in development beyond some archetypal ideal.
Then, digging a bit more into a societal issue, women are often portrayed as capricious creatures whose moods change at the drop of a hat and never say what they mean — i.e. “I’m fine.” They’re made out to be enigmatic puzzles that men have to crack — “What does she really mean when she says ‘no’?” Thus there’s this idea that it’s hard to understand how the minds of women work because they’re so “different” to men. (Spoiler: they’re not.) This makes male writers view writing women, especially from the POV of a woman, difficult. They approach the task with greater apprehension and then rely on archetypes to help fill in the blanks.
It’s silly to me because if they approached writing their female characters the same way they do their male characters, they’re likely going to have a better character and have an easier job writing her.
That’s really the secret to writing characters that aren’t the same gender as you. Approach them as you would a character of your gender (or whatever gender you’re most comfortable writing). Develop them by the same process as your other characters. Mention a gender-specific outfit or physical characteristic at some point when you introduce them. Then write them as you do your other characters.
It works because most characters — most people — their entire identity isn’t defined by their gender. There should be a lot more to your character than their gender. It should mean about as much as, say, their eye color. Sometimes a character’s eye color is a big part of the story, sometimes it’s something that is barely worth mentioning.
Yikes, I went off on a tangent. Sorry.
I’m very tired, so there may be errors, but I think I made the point I wanted to?