Context. Classical T Tauri stars (CTTs) magnetically interact with their surrounding disks, a process that is thought to regulate their rotational evolution. Aims. We compute torques acting on the stellar surface of CTTs that arise from different accreting (accretion funnels) and ejecting (stellar winds and magnetospheric ejections) flow components. Furthermore, we compare the magnetic braking due to stellar winds in two different systems: isolated (i.e., weak-line T Tauri and main-sequence) and accreting (i.e., classical T Tauri) stars. Methods. We use 2.5D magnetohydrodynamic, time-dependent, axisymmetric simulations that were computed with the PLUTO code. For both systems, the stellar wind is thermally driven. In the star-disk-interaction (SDI) simulations, the accretion disk is Keplerian, viscous, and resistive, and is modeled with an alpha prescription. Two series of simulations are presented, one for each system (i.e., isolated and accreting stars). Results. In classical T Tauri systems, the presence of magnetospheric ejections confines the stellar-wind expansion, resulting in an hourglass-shaped geometry of the outflow, and the formation of the accretion columns modifies the amount of open magnetic flux exploited by the stellar wind. These effects have a strong impact on the stellar-wind properties, and we show that the stellar-wind braking is more efficient in the SDI systems than in the isolated ones. We further derive torque scalings over a wide range of magnetic field strengths for each flow component in an SDI system (i.e., magnetospheric accretion and ejections, and stellar winds), which directly applies a torque on the stellar surface. Conclusions. In all the performed SDI simulations, the stellar wind extracts less than 2% of the mass accretion rate and the disk is truncated by up to 66% of the corotation radius. All simulations show a net spin-up torque. We conclude that in order to achieve a stellar-spin equilibrium, we need either more massive stellar winds or disks that are truncated closer to the corotation radius, which increases the torque efficiency of the magnetospheric ejections.