Include <stdexcept> for runtime_error.