Building an irreversible Carnot-like heat engine with an overdamped harmonic oscillator