Process and apparatus for transferring heat from a first medium to a second medium