Euclid preparation. XV. Forecasting cosmological constraints for the Euclid and CMB joint analysis