  We expand the standard thermodynamic framework of a system coupled to a
thermal reservoir by considering a stream of independently prepared units
repeatedly put into contact with the system. These units can be in any
nonequilibrium state and interact with the system with an arbitrary strength
and duration. We show that this stream constitutes an effective resource of
nonequilibrium free energy and identify the conditions under which it behaves
as a heat, work or information reservoir. We also show that this setup provides
a natural framework to analyze information erasure ("Landauer's principle") and
feedback controlled systems ("Maxwell's demon"). In the limit of a short
system-unit interaction time, we further demonstrate that this setup can be
used to provide a thermodynamically sound interpretation to many effective
master equations. We discuss how non-autonomously driven systems, micromasers,
lasing without inversion, and the electronic Maxwell demon, can be
thermodynamically analyzed within our framework. While the present framework
accounts for quantum features (e.g. squeezing, entanglement, coherence), we
also show that quantum resources do not offer any advantage compared to
classical ones in terms of the maximum extractable work.
