I have been working in my office for a few years. Around one year ago the only two people in the office were my boss and I. We honestly didn't like each other too much but we had always been polite to each other and we had always worked together decently.
One year ago we hired a new junior member of the team to work with me. We decided together that this new person should have been (informally) supervised by me and that's exactly how things went for the first months this person was here.
In the last months my boss and the new person have become much more closer. This fact by itself is not a problem, except for the fact that my boss started to give directions to this person. I'm fine with him been asked to do other things but I have now difficulties planning his time, and been sure about he can meet the deadline I set for him. Sometimes I may plan the work to do for the following week and by Wednesday he may be asked by my boss to work on something completely different. Sometimes I'm asked about long term estimates, and after I set a deadline he may be assigned to a different project for a few weeks.
Now in the last weeks a new thing is happening. The two have started to spend more time together alone during the working hours (sometimes by been plain rude to me saying things like "we need to stop working for a second and have a small chat, but we prefer to be alone"). The main problem here for me is not missing the invite to drink a coffee with them, but mainly that they often end up discussing things about our projects that may not remember to tell me when we are together again.
So in essence, I feel that my authority in the office is undermined. I cannot effectively lead the projects I should because I cannot trust my team member collaboration and I occasionally miss crucial information.
This situation is also causing me some personal stress for obvious reasons.
EDIT: I'll add more details and a final question:
First of all, looking for help by the boss of my boss would be a bad move. They are very close, and even if I were right, the suggestion would be to leave the company anyway (happened years ago to a coworker).
Second, as the saying goes, if you run into a jerk, you run into a jerk, if you find jerks wherever you go you may be the jerk. I really tried to understand if something in this situation may be my fault but I really don't see anything. I think it's important to add that I'm generally quite appreciated by my coworkers outside of my office. Just to give you a simple example, I'm frequently asked to collaborate on projects from other offices and invited to all kind of events, so I don't really think that I'm the werido in this situation.
I'll add that if it was possible to switch office inside the same company, I would do that immediately.
So let's get to the final question. Leaving the company may be an option, although not a pleasant one. I may be do that in a few months if the situation keeps on getting worse. But do you have any suggestion to fix the situation or at least trying to make more bearable?