I've found that holding the lens right up to the glass (with something protecting it like a UV or clear filter) will result in a clear photo. Keep in mind though, that most train glass has a tint to it, so you'll have to process some color correction into your final image.
Here's an example. Fortunately, this glass isn't heavily tinted.
This was corrected as it was shot through bluish-tinted plexiglas on an overpass, one of the few along the NEC.
As you can see, it's possible to shoot through glass, as long as it's relatively clean and not vandalized (scratchitti).