Magnetospheric processes at cool stars and exoplanets