The neutron star in HESS J1731−347: Central compact objects as laboratories to study the equation of state of superdense matter