Right-click the player's name and pick Trade With from the menu. If they accept, both of you are pulled into a trade window.
Add the items you're offering, hit the red X to lock your side, and wait for the other player to do the same. Check the confirmation screen carefully before you accept — that's your last chance to spot a swapped item.
If the option is greyed out, the player may be in a fight, in a cutscene, or simply too far away.