A man is recovering in hospital after being struck by lightning during a storm in Sydney.