An energetic approach to friction, wear and temperature