If a friendship will produce more pain in the long run (although that seems difficult to achieve), then we should end it, or at least de-attach us.
Or conclude either that (1) it is not a friendship at all, or (2) our definition of friendship needs reworking.