Except when it is declared otherwise, the provisions of this code in respect to the rights and obligations of parties to contracts are subordinate to the intention of the parties, when ascertained in the manner prescribed by the chapter on the interpretation of contracts. The benefit thereof may be waived by any party entitled thereto, unless such waiver would be against public policy.