Four men have been pulled from the water after clinging to their capsized boat when heavy swell threw them overboard.