Sometimes in the process of loving others something happens to you and your heart starts to heal. It's bullshit that to love someone else you need to love yourself first. sometimes that other person can show you parts of yourself you didn't know existed, and you can discover parts you love piece by piece. before you know it loving someone else has taught you to love yourself too.
Of course this only works for people who are not careless with your vulnerability.