Any insurance company organized under a special law may declare dividends out of its surplus earnings at such times and at such per cent of its capital stock as a majority of the directors determines. No dividend shall be made when the capital stock is impaired or when the making of the dividend would have the effect of impairing the capital stock, anything in the law creating the company, or its amendments or supplements, to the contrary notwithstanding.