I think I understand how moving slowly between equilibrium states allows for a process to be closer to being reversible, but I'm still a little confused as to how friction contributes to irreversibility. I saw an example of a block on an inclined plane that stated that after the block was pushed down the plane and back up (to it's starting position) it didn't cool back to its initial T which makes sense. However, I'm missing something with these piston examples that involve slowly removing and readding pebbles. In the picture I drew the gas has to do W to move the piston. If net work is W-Ffr then in both cases of going from A to B or back from B to A the net work should be the same (assuming friction doesn't change). If the net work is the same wouldn't U return to its original state and the process be reversible? [![enter image description here][1]][1]


  [1]: https://i.sstatic.net/FVFfy.jpg