The Riemann problem for a class of resonant hyperbolic systems of balance laws