Thermal energy and friction