What others gain is not your loss.
I once heard a great analogy on this.
So imagine you go to a party. It opens with a buffet, where the food is spread for everyone across a few tables. The food is plentiful: there are fruit platters spilling with melon and berries, sushi stacked in all shapes and sizes and colors, cuts of meat artfully arranged on rectangular trays, vegetables cut to snacking sizes, salads, cookies, and drinks lined up for duty. But as you casually mill about, you can't help but attempt to cut ahead of people to reach the platters, trays, and bowls. You overstock your plate with the worry the food will run out, artfully shove people out of the way to get to the sushi before it runs out, and fill your cup up the top with soda in case it's gone.
The hosts have planned to make sure there is enough food for everyone, but the buffet style meal creates a panic in which we can't help but believe that other people filling their plates will take away from the portions we can select for ourselves. It's as if the entire concept of food as we know it will be gone within minutes! We frantically stab the last few chunks of pineapple, drain our glasses so we can top them off again, and refill our salad plates before we've finished all the pieces of lettuce. We compete with the other guests - despite our friendly conversation - to ensure we get the portion we deserve.
When the buffet is over, the event continues - perhaps with a speaker, a performance etc. When it's time for dessert, waiters come around with individual plates for each guest. The same people who were elbowing to get to the front of the buffet table before their friends now elegantly say, "please, you take the first portion. I can wait."
Where has the worry and panic and hurry gone? Why is everyone so patient and generous all of the sudden?
Because it is much more clear that there is a plate reserved for everyone. If the hosts informed the caterer that 208 people are coming, there are 208 plates waiting in the kitchen - there is definitely one for me, so I'm happy for you to get first. I'm feeling magnanimous. I feel secure in the knowledge of the portion I will receive, and there is no frantic competition between us.
We have to understand something about life: Life is not a buffet. It's served up on individual plates for each of us. When we come to recognize this, our friends' successes and victories and possessions will not faze us. We know that we can work for whatever we want, and what our friends work for does not affect what is coming to us. If the guy you want lands up with a different girl, he's not the guy for you! If someone else got the promotion you wanted - it wasn't meant for you. Work a little harder, and if you deserve it, you will get your own promotion.
In recognizing that there are portions of happiness, wealth, and success in reserve for each of us, we would be much less resentful of others' success, and lead more secure, happier, satisfied lives.