Original: This is normally achieved by a reversing valve.
Simplified: It moves heat from the inside to the outside.