When you shift your focus to someone else in pain, you take your mind off of your pain. The compassion you mentally extend to them will alleviate your pain.
Having wise selfishness will help you achieve joy and happiness in the long run, but being foolishly selfish will ensure you never experience lasting joy or happiness. This is because when you focus and obsess about yourself and your desires, you will experience suffering.
Remember, humans are social creatures. We need friends—genuine friends. The only way to do this is to trust in others and help them. This is actually supported by scientific research: those who think about themselves tend to be socially withdrawn and unhappy, but those who are sociable and creative tend to be happy!
When you are in pain, shift your focus to another person.
The next time you are experiencing pain, think about the pain and suffering of someone else and extend compassion toward them in your mind.
Have wise selfishness, not foolish selfishness.
Foolish selfishness refers to only thinking of yourself, and bullying and exploiting others to achieve your goals. Wise selfishness refers to helping and taking care of others so as to discover your own joy and have a happy life.
Think about how you can help others.
You are not alone in this world—extend compassion to others, make more friends, and think about how you can help them. To do this, trust in others. Do not concern yourself with how you can exploit or take advantage of those around you; instead, think about how you can extend compassion to them.