I'm not afraid to write female characters. Or black characters. Or gay characters. Or Muslim unicorn accountant characters. I believe that a writer should be able to inhabit the soul of anyone, and write about it. Does that mean I do it well? Who knows! Who cares! Either way, I learn something, and maybe the reader does too.
There's a quote by someone saying that books are empathy machines. I think this is true. Novels and fiction are one of the few ways we can ever really get a peak into the mind and soul of other people. We can watch people talk and take action on television, but we don't look into their minds. This is what fiction is for.
If you look at history, you see the actions and words of people. But that is only a fraction of who we are. We live our lives in the interiors of our hearts and brains. People may experience our actions and words, but they may not understand them. We might know what happened in history, but we can only guess why. Some people think history is the resulte of external causes and movements. I don't think so. History is people acting on their impulses and their judgments, and the resulting morass is our world.
So through fiction we learn the minds and souls of others. And hopefully, gain an understanding into why other people do what they do, and what they're experiences are like, and how they are different than we are.
My father thinks that children should study hard sciences and applicable skills in school. I think it's more important children are taught literature. Maybe if people could look outside themselves a bit, we would live in a better world. One can only hope.