Well, with chickens sometimes girls can become boys. It's rare - one study done showed that the rate was 28 out of 3,000. But, the point is, it DOES happen. With chickens, sex differentiation is a mix of genetic and hormonal mechanisms in their bodies. The sex reversal is believed to be linked to alterations of the sex steroid hormones, due to problems with one of the oviducts during embryonic development. This leaves the hen with only one functional ovary. If that one is damaged due to disease or injury, then the regressed one can form into an ovotestis. If the healthy ovary had stayed functional, the estrogen secretion suppresses this. But in this case, it cannot, and the ovotestis secrets androgens, primarily testosterone, and then the hen's plumage changes. She grows saddle feathers, a rooster's comb and wattles, and then crows. SHe behaves like a rooster, calling i the hens for food, leading the flock in and out of the coop, and crowing up a storm There was one reported case where the she-rooster actually secreted sperm and was able to impregnate eggs.
Sounds crazy, but it does happen. I know of one that happened up in Georgia when I was living there. Funny thing is, the chicken experts will tell you that no one really knows the exact mechanism underlying sex differentiation in birds. Some things in Nature are still a mystery, unlocked by science.
This reminds me of what happened in Jurassic Park when the supposedly all female dinosaurs were able to procreate and produce fertile eggs. The scientist played by Jeff Goldblum says "life finds a way". That's probably the best explanation of all of this.