i suggest you just talk to her normally and see how she responds...dont ask her out go by what she does...if she is being super flirty towardes you and not showing that much interest in your friend then I think your friend will realize this himself and loose interest in her and then you can ask her out and I don't think your friend would be mad because it was the girl's decision who she wanted to date...so just try and become friends with her
You don't have to necessarily loose him. You can still like her and be his friend, just don't talk about how much you like her in front of him and don't flirt with her in front of him neither. My best friend and I both like the same guy, just that she doesn't know I like him too. You could do that, not let him know you like her too.
Good luck ;)
pd: if it gets too problematic, remember friendship is much more important than a crush.