We investigate the heating of an erupting prominence and loops associated with a coronal mass ejection and X-class flare. The prominence is seen in absorption in EUV at the beginning of its eruption. Later the prominence changes to emission, which indicates heating of the erupting plasma. We find the densities of the erupting prominence using the absorption properties of hydrogen and helium in different passbands. We estimate the temperatures and densities of the erupting prominence and loops seen as emission features using the differential emission measure method, which uses both EUV and X-ray observations from the Atmospheric Imaging Assembly on board Solar Dynamics Observatory and the X-ray Telescope on board Hinode. We consider synthetic spectra using both photospheric and coronal abundances in these calculations. We verify the methods for the estimation of temperatures and densities for the erupting plasmas. Then we estimate the thermal, kinetic, radiative loss, thermal conduction, and heating energies of the erupting prominence and loops. We find that the heating of the erupting prominence and loop occurs strongly at early times in the eruption. This event shows a writhing motion of the erupting prominence, which may indicate a hot flux rope heated by thermal energy release during magnetic reconnection.