The most interesting thing about this particular device is that it usually involves a female pretending to be male, pretending to be female (as opposed to a male pretending to be a female, pretending to be a male).
There are two common interpretations of this device:
The first involves a female character, played by a female actress, who acts as a male pretending to be female. An example is Julie Andrews' character in the film, 'Victor/Victoria' (1982).
The second involves a female actress who plays a male who has become female (usually via hormonal and surgical means). An example is Olympia Dukakis in 'Tales of the City' (1992?) or Ally Sheedy in the Boston production of 'Hedwig and the Angry Inch'(1999).
Sometimes this device is used for laughs, sometimes to make the female 'illusion' more credible and sometimes for something a little more complex, such as irony, where only we, as the audience, know who the character really is.
See also gender fuck, gender, transvestite, drag king, transsexual, transgender