That’s called “sympathy” in the technical sense in psychology. It’s the thing that psychopaths lack.
However, if you are completely unable to see people you like experience pain, then this is sympathy combined with a lack of emotional fortitude.
It’s important to get past this “unable” state, because it will cause you to bury your head in the sand when people you love need help, if you are literally unable to stand seeing them in pain.
For someone who dislikes others’ pain, heroism comes naturally. But for someone who is unable to see others’ pain, denial and cowardice is the natural result.