A Friedrichs–Maz'ya inequality for functions of bounded variation