Futabakun Change. Although in the end, Misaki finds out, accepts it, and finds a way to Gender Benderherself in the same way to make herself a compatible mate to Futaba-kun/chan, similar to the Zerophilia example below.
Fudanshism runs off of this; the protagonist disguises himself as a girl when his sister is too sick to go to a convention where he runs into his crush. To the protagonist's increasing bafflement his crush quickly becomes good friends with his female alter-ego while continuing to ignore the real him.
Inverted in Ranma ½. Shampoo loves Ranma when he's a boy, because he beat her in a fight and she comes from an obscure Chinese Amazon-like tribe that marries men who beat them. When he's a girl, Shampoo wants to tear him to shreds, because he beat her as a girl too and that's another tribal custom.
Once she found out that they were the same people and that he was originally a boy, she is just plain affectionate to him/her in both forms, unless s/he pisses her off.
Played straight with Akane befriending him before she found out that it was actually a boy who beat her in a spar.
In Ame Nochi Hare, Hazuki and his friends turn into girls whenever it rains. He gets gets more friendly with love interest Asumi as a girl than as a guy.
Oddly enough, the trope is also played with here. Hazuki, in "Tsukiko" identity, manages to strike up a friendship with Asumi's brother, Takuma. They get along quite well and seem to enjoy each other's company. In guy-form, Hazuki finds Takuma's stoic demeanor to everyone else unsettling and Takuma only knows Hazuki as "Tsukiko's cousin". Hazuki explicitly notes that they wouldn't ever be friends if it weren't for his gender swapping. Asumi and Hazuki's friend Touma ship them.
One of the major plots of the Thor fanfic (All) Father Loki. After Loki’s girlfriend, Sigyn, discovers that he had impregnated Angrboda, he transforms into a woman to eliminate the risk in future relationships. It’s Loki’s daughter, Hel, who suggests that he spend some time with Sigyn in his female form to patch up their broken relationship.
Zerophilia is about a genetic condition that switches people's genders after sex, in the end the hero/heroine discovers his girlfriend/friend and boyfriend/rival are the same person.
In Sorority Boys, the three male leads are kicked out of their fraternity and dress up as women to seek refuge in what is deemed the "ugly" sorority house. In the process, one of the men ends up being friends with a girl he'd met earlier and hit on unsuccessfully, but now has a chance to get to truly know. Of course, Hilarity Ensues.
One of the other leads, a supposed Dumb Muscle, also befriends a number of the unpopular girls in the house (particularly a girl suffering from giantism) after learning that they've been judged by their looks all their lives, just like he has.
Some Like It Hot: Two male musicians on the run are forced to to hide in an all-girls band. As girls. Naturally, they become quite chummy with the other musicians.
The last book in Sean McMullan's Greatwinter Trilogy has this happen to its lovable letch John Glasken. Irony of ironies, he winds up enjoying girl-friendship more than hawt sechs, as shown in the page quote.
An intensely awkward example happens in Sergey Lukyanenko's Night Watch when Anton's had his mind swapped with Olga. He can't tell Svetlana what's happened until they reach her warded apartment... after she's had a very private conversation with "Olga" about Anton.
This happened in The Zack Files once, except that the Gender Bent character was trying to set the girl up with his friend, not with himself.
In the 2004-2005 French series Vice Versa, the main character Thomas sometimes uses his double Emmanuelle/Julia in order to get information on his crush.
Sabrina the Teenage Witch did this deliberately with a spell to turn her into a boy so she could find out what her boyfriend talked about with his friends when girls weren't around.
In El Goonish Shive, Susan starts out with a low opinion of Elliot. During the time Elliot is stuck as a girl, Susan inadvertently strikes up a friendship with him and he tries to convince her he is not that bad. By the time she sees Elliot male again, he manages to validate the claims he made when he was female through his defense of Ellen which makes her see him in a new light and they eventually become good friends.
The Fairly OddParents: Timmy once accidentally wished himself into a girl, then using it to find out what present to get his crush, Trixie. After becoming best friends with her under his assumed gender, he turns back into a boy, goes to the party and attempts to act sensitive. He's promptly thrown out by security. It should be noted that although Trixie had him thrown out, it looked as though she was genuinely touched by his attempt. She even remembered his name. Since he was only thrown out so she could maintain her reputation, one wonders how she would have responded if they had been alone... wait, nevermind.
Cybersix has a combination of this with the main character's Secret Identity male persona Adrian with her best friend/love interest Lucas.
King of the Hill has a variant when Peggy unknowingly shops in a store for crossdressers and befriends someone who assumes she's also a man in drag. Unfortunately, he doesn't realize the truth until he'd already invited her to participate in his drag show...