How does gas friction emerge? The fluid parcel model states that a gas can be modelled as the sum of infinitesimal small parcels. According to this model, the friction of a gas with a solid surface (e.g. the wall of a pipe) results when the boundaries of a parcel "slide" against the solid surface which creates heat and decreases the parcel's velocity.
But a gas only consists of atoms or molecules. Microscopically, there are no boundaries onto which forces can act. Furthermore, all collisions between molecules and the wall are elastic with no kinetic energy lost.
So, how does the phenomenon emerge what we see as "friction" of a gas? How does the transition occur from no friction (microscopic) to friction (macroscopic)?
 A: Consider a solid body moving through gas, what happens then is less like friction and more like waddling through a ball pit: 
As the object moves forward, molecules that collide with it will recede with greater momentum than before, at the expense of the object's momentum. The tiny amount of velocity it loses with each collision, takes away kinetic energy as well.
This mechanism of "friction" is usually called moment diffusion.
A: Friction can be recognized in a statistical description of a microscopic view, not only in macroscopic view.
It is when energy (or any other conserved quantity) that was previously organized becomes disorganized. In this case, when the atoms that were flowing along the surface, after interaction with that surface, lose that flow, and the energy associated with that flow is dispersed among the atoms of the air and the surface.
As long as the gas is flowing over the surface, the system is out of mechanical equilibrium, so there is energy to extract from those mechanical degrees of freedom.
If you're not sure what I mean by 'mechanical' degrees of freedom... look at the gas particles in momentum space / Fourier space. If there's energy we'd consider 'mechanical' energy around, then the long-range modes of this distribution will be far from a Fermi distribution. As friction takes hold, these modes will fall away and the distribution as a whole will change into a Fermi distribution.
