  Originally formulated for macroscopic machines, the laws of thermodynamics
were recently shown to hold for quantum systems coupled to ideal sources of
work (external classical fields) and heat (systems at equilibrium). Ongoing
efforts have been focusing on extending the validity of thermodynamic laws to
more realistic, non-ideal energy sources. Here, we go beyond these extensions
and show that energy exchanges between arbitrary quantum systems are structured
by the laws of thermodynamics. We first generalize the second law and identify
the associated work and heat exchanges. After recovering known results from
ideal work and heat sources, we analyze some consequences of hybrid work and
heat sources. We illustrate our general laws with microscopic machines
realizing thermodynamic tasks in which the roles of heat and work sources are
simultaneously played by elementary quantum systems. Our results open
perspectives to understand and optimize the energetic performances of realistic
quantum devices, at any scale.
