Of more than a thousand known cataclysmic variables (CVs), where a white dwarf is accreting from a hydrogen-rich star, only a dozen have orbital periods below 75 minutes1-9. One way to achieve these short periods requires the donor star to have undergone substantial nuclear evolution before interacting with the white dwarf10-14, and it is expected that these objects will transition to helium accretion. These transitional CVs have been proposed as progenitors of helium CVs13-18. However, no known transitional CV is expected to reach an orbital period short enough to account for most of the helium CV population, leaving the role of this evolutionary pathway unclear. Here we report observations of ZTF J1813+4251, a 51-minute-orbital-period, fully eclipsing binary system consisting of a star with a temperature comparable to that of the Sun but a density 100 times greater owing to its helium-rich composition, accreting onto a white dwarf. Phase-resolved spectra, multi-band light curves and the broadband spectral energy distribution allow us to obtain precise and robust constraints on the masses, radii and temperatures of both components. Evolutionary modelling shows that ZTF J1813+4251 is destined to become a helium CV binary, reaching an orbital period under 20 minutes, rendering ZTF J1813+4251 a previously missing link between helium CV binaries and hydrogen-rich CVs.