That question is usually asked when the girl is slightly intimadated by the other girl...or the girl feels more attractive and is fishing for compliments "
(this really is a possibility) she is a friend of the other girl and she wants to know if you are attracted to the other girl...so she can report to the friend whether or not you are attracted to her (this happens if the other girl is interested in you)
Well in my case if I ask a guy that it's because I'm feeling kind of insecure, or I notice the guy has wandering eyes. I think every girl wants to hear that her boyfriend thinks she's beautiful, or even the most beautiful to him.
Women's minds work in mysterious ways, the Mrs also asks me this a lot when I second glance at a girl hehehe, I know it's not good and it upsets her a bit, but she's okay about it because she knows it's my primitive half of my mind going to work without me knowing.
I counter this question by pointing out to a good looking guy and say "No, but I think he's handsome" get her to look at the guy and then get a big laughing smile from her.
But yes, from the wise words of Admiral Ackbar link