This quote is suggesting that even though it can be hard to accept, everything that happens has a purpose. People change, or drift away from us, for us to learn how to let go. Things occasionally go wrong, so we can appreciate them when they do go right. We need to go through moments of believing things that turn out not to be true in order to learn to rely on ourselves. Sometimes, things that appear to be good end, so something even better can replace it.