You feel confident when in certain situations, but when specific people are around you feel the need to compete for the friendship. Your “friend” encourages this by naturally not making social concessions/offering agreed upon reassurance towards you. When confronted your friend acts like they didn’t notice because they do it on purpose as their way of controlling you. Confused you assume it is just in your mind, so you try to ignore it. It happens again when the “better” friend is around.
Suddenly you realize that there is a hierarchy and the needs of the friends higher on the list are met before yours. Often the needs of higher friends is that your “friend” be cold to their lower friends. This modern day Machiavellianism is how friends exert dominance other each other for their own negative, controlling self indulgence.