Strange Parents

Animals are usually either male or female and behave in a way that is characteristic of their gender. But in nature, there are some curious exceptions. Female hyenas look and behave like males, and male seahorses actually get pregnant and give birth. Why have these two animals swapped their sexual identities?