as provided in the contract, by an agreement in writing to which it is a party, or by a declaration, with interest at a rate agreed upon therein or, where no rate is agreed upon, at the rate declared from time to time by the insurer in respect of insurance money so held by it.