There are lots of girls out there writing from a guys perspective. And there are lots of guys writing from a girls perspective. So there are plenty of examples of where it works.
On the flip side, I'm sure there are some examples of where it doesn't/wouldn't work.
YA, MG, Picture Books, General Fiction, Sci-Fi, Thriller, etc, etc, can all be written from either a man or a woman--no matter who the MC is.
Romance is the only genre where this question is...well, questioned. Let's face it, men don't really know what women want. HOWEVER, there have been some very successful MALE romance writers (most of which wrote under a female pen name because of gender bias).
There is a lot of room for people to argue this point one way or another. I, however, don't base anything on gender. This world is diverse, WE are diverse. So instead of wondering if a boy/girl could write a good perspective from the opposite sex, ask yourself:
CAN YOU WRITE ANY PERSPECTIVE WELL?
If you're a girl, can you write a girl? At any age?
If you're a guy, can you write a convincing guy? At any age?
So the same is asked if you are writing from a different perspective.
Can you be convincing in any perspective? You're a writer, you're creative, you develop people from scratch. It's not a gender issue--is a creative issue.
CAN YOU BE CREATIVE?
You've written characters who are professional race car drivers, chefs, killers, tech freaks, etc. I'm pretty sure you aren't any of the those people. Well, I hope you aren't a killer. If so, please unfollow me. ;-)
Back on point... if you did write characters that are nothing like you how did you write those convincingly? You researched, right? So now the question is:
CAN YOU BE AUTHENTIC?
Your gender doesn't matter. Your mind does.
And in the end, if you are still second guessing yourself, do MORE research. Or have someone who knows about it read it. Let me know if you are able to catch Jeff Gordon on the racetrack or Charles Mason during visiting hours. But seriously, if you are worried about writing from a different gender POV, have that gender read it to see what think. Or research it. And read it. Lots of reading helps.
Do you peeps have any good examples of male writing female and vice versa? Do you have any specific examples (of your own struggles/successes) you'd like to share?