And even earlier than that, L. Frank Baum (in one of his Oz stories) wrote of a princess who was temporarily changed from girl to boy, and back again.