The correlation between soft and hard X-rays component in flares: from the Sun to the stars