system
Given the following post, respond as if you're commenting on Reddit:
human
How does a neutron star generate a magnetic field if it is composed entirely of neutrons?
gpt
Mostly because it's not composed *entirely* of neutrons - just nearly so. 

The very outer layers of a neutron star are "normal" matter (as normal as 1,000,000 K matter can be, that is) and probably consist of a very dense fluid of nuclei and electrons. This layer is conductive, and so combined with the very fast rotation of the neutron star as a whole, can generate quite a whomping magnetic field.

Farther inside, as the pressure increases, we find a higher density of neutrons as degeneracy pressure fuses more and more electrons and protons. But still, there are some particles with electric charge to be found, and so a source for a magnetic field.

Even in the very center of a neutron star we're not completely sure what we'll find; but if there are free charged particles forming any kind of fluid, then again a magnetic field can form.