the sun = an electric capacitor
Science books tell us the sun is made up mostly of hydrogen. So far so good. What they often fail to mention is that the hydrogen is in a plasma state. What this means is that the protons and electrons are in a free state. The protons and electrons have separated due to the intense solar environment.
The outer surface of the sun is thus a seething ocean of free electrons. The protons are heavier and are found lower - below the outer layer.
But what is electricity? Free electrons!
The outer surface of the sun therefor holds an extremely powerful electrical charge!
How come they never told us about this in school? Good question. I suppose the answer is that the present Big Bang cosmological model is solely based on gravity. It does not account for electromagnetism -- and this is one of its main weaknesses. It's why we need a better model of how the solar system works.
Now let's see how comets and planets discharge the solar capacitor...