Accelerated electrons and hard X-ray emission from X-pinches