How to deal with being in love with your best friend's girlfriend
Love can be very tricky and hard to hide. One of the great yet challenging things is being honest with yourself, which you have already done by acknowledging being in love with your best friend's girlfriend and acknowledging the feelings connected to this reality, which is the first step. You have identified that this is someone who you can never be with and it sounds like you have come to terms with that. You also mentioned "Being with her would mean choosing between her and my friend" and this may come with the assumption that the feeling is mutual, which could be true or false. Identifying the pros and cons of saying something is important as it seems you value this friendship and this could cost you losing both friends. Although you all have perhaps built a strong connection with each other and are possibly around one another often, the second step is to set healthy boundaries for yourself by exploring ways that you can minimize hurtful interactions. For example being intentional about not being alone with this friend, not spending too much time with them, or asking questions related to their feelings about you. This is not easy to do at all, however, in trying to work through these feelings sometimes limiting interactions with that person is necessary. It sounds like friendship, comfort, and connectedness are important to you as it relates to romantic interests with others. Another step can be taking some time to think about what you love about that person so that you can be intentional about future romantic connections with others that will be meaningful to you based on what you like.
You mentioned feeling shameful and guilty and the reality is we cannot always help who we are attracted to or fall in love with. Be sure to practice giving yourself grace knowing that you are human. Moving forward with this situation will take some time and could even be a grieving process. Giving yourself that time and seeking professional support can also help you talk through it. Coping with situations as such will look different for everyone.