I tried to do this but honestly have little idea:
That's a very random attempt. You try to check if one rectangle is less than the other -- there's not even such an operator, let alone are rectangles the right thing if you're talking of positions...
You should use the rectangle's centers. To calculate the distance, the function
thor::length() can be helpful. You should have a look at basic vector algebra though; it's crucial to understand when working with SFML, even more so when developing a game.