Two-compartment heat exchanger