
351 N.W.2d 707 (1984)
217 Neb. 877
David S. BLANCHARD, Appellant,
v.
Constance B. WHITE, Personal Representative of the Estate of Mildred G. Blanchard, deceased, Appellee.
No. 83-805.
Supreme Court of Nebraska.
July 13, 1984.
*708 Michael R. Snyder of Tvrdik, Brandt & Snyder, and Stephen G. Lowe of McMullen & Lowe, Kearney, for appellant.
C. Russell Mattson of Mattson, Ricketts, Davies, Stewart, Calkins & Duxbury, Lincoln, for appellee.
KRIVOSHA, C.J., BOSLAUGH, WHITE, HASTINGS, and SHANAHAN, JJ., and COLWELL, District Judge, Retired.
HASTINGS, Justice.
This was an action brought by David S. Blanchard, as a third-party beneficiary, seeking an injunction, a constructive trust, *709 and specific performance for breach of a written contract to make a will. The action, filed against the personal representative of the estate of the plaintiff's stepmother, sought to enforce a memorandum executed by the plaintiff's father, Charles A. Blanchard, and his stepmother, Mildred G. Blanchard, in which Mildred agreed to make a codicil to her will leaving to the plaintiff the residue remaining at her death of property devised to her by Charles, her husband, under a will executed the same day, February 25, 1972.
After the trial court sustained a motion to strike portions of the plaintiff's petition, an amended petition was filed, to which the defendant demurred. The district court sustained the defendant's demurrer and found the memorandum identified in the pleadings to be a void postnuptial contract due to noncompliance with the acknowledgment provision of Neb.Rev.Stat. § 30-106 (Cum.Supp.1969), rather than a contract to make a will.
The district court further found that the petition did not allege that mutual or reciprocal wills existed and that since Charles A. Blanchard's will gave to Mildred what would have been hers legally upon his death, there was no consideration for Mildred's promise to make a codicil. Upon the plaintiff's refusal to plead further, plaintiff's amended petition was dismissed and this appeal followed.
In his appeal to this court the plaintiff assigns as error: (1) The sustaining of the motion to strike the allegations of the petition relating to joint tenancy property received by defendant's decedent; and (2) The sustaining of the defendant's demurrer to the amended petition, because the court erred in finding § 30-106, the postnuptial statute, to be applicable and that the contract to make a will was not supported by consideration.
Charles A. Blanchard executed his will on February 25, 1972, giving one-fourth of his entire estate to his wife, Mildred G. Blanchard. On the same day his will was executed, Charles and Mildred executed the memorandum agreement which provided in part:
Whereas, Charles A. Blanchard has on this day made a last will and testament in which he gives to Mildred Blanchard one-fourth of his estate; and,
Whereas, Mildred Blanchard desires that she retain the use of said one-fourth of the estate of Charles Blanchard only during the remainder of her natural life and that any residue thereof remaining shall go to David Blanchard, a son of Charles A. Blanchard, or his heirs, upon the death of Mildred Blanchard:
Now, therefore, it is stipulated that in the event of the death of Charles A. Blanchard, Mildred Blanchard will make a codicil to her last will and testament providing that upon her death any residue remaining of the property willed to her by Charles A. Blanchard shall go to David Blanchard, his son, or to the heirs of David Blanchard.
The memorandum agreement was signed by Charles and Mildred Blanchard and one witness. Charles died June 29, 1972, and his will was admitted to probate. Mildred received $7,500 in cash and 11,250.0225 shares of Affiliated Fund Investment Trust. On March 18, 1980, Mildred died testate, leaving a will with two codicils, but no provision was made for the plaintiff.
It is the rule of law that an agreement to devise and bequeath property is, where supported by consideration, valid and enforceable. In such a case equity will impress a trust upon the property, which trust will follow it into the hands of the personal representative of the promisor or into the hands of a grantee who has not given consideration for the conveyance. Allen v. Mayo, 203 Neb. 602, 279 N.W.2d 617 (1979).
A general demurrer tests the substantive legal rights of the parties upon admitted facts, including proper and reasonable inferences of law and fact which may be drawn from facts which are well pleaded. On reviewing the sustaining of a demurrer, this court must treat as undisputed *710 the facts as alleged in the petition. Philp v. First Nat. Bank & Trust Co., 212 Neb. 791, 326 N.W.2d 48 (1982).
In the present case the trial court concluded that if the memorandum agreement was a postnuptial agreement, it was void because not acknowledged as required by § 30-106. That section provides in part:
A man or woman may also bar his or her right to inherit part or all of the lands of his or her husband or wife by a contract ... [which] shall be in writing signed by both of the parties to such marriage and acknowledged in the manner required by law for the conveyance of real estate.....
(Emphasis supplied.)
This statute, which was repealed in 1974, refers to lands. The property here in dispute is all personal property. Therefore, although we do not believe that it was a postnuptial agreement, we are convinced that the postnuptial statute does not in any event apply in this instance.
It was the finding of the trial court that the memorandum failed as a contract to make a will because of an absence of consideration. On review of the pleadings the amended petition alleged the execution of the last will and testament by Charles A. Blanchard was consideration for the execution of the contract by Mildred G. Blanchard. It is the rule that contracts for testamentary or similar disposition of property must, like other contracts, be supported by a sufficient valid consideration. Allen v. Mayo, supra; In re Estate of Nelson, 127 Neb. 563, 256 N.W. 27 (1934).
Also, if a petition states facts which entitle the plaintiff to relief, whether legal or equitable, it is not demurrable upon the ground that it does not state facts sufficient to constitute a cause of action. Philp v. First Nat. Bank & Trust Co., supra.
In the present case the trial court was correct to note that this was not a situation where mutual wills existed with mutual promises by the husband and wife, amounting to sufficient consideration. But, just because the wills were not mutual and did not contain mutual promises, that does not eliminate the possibility that consideration may have been present to support a valid contract.
There is a sufficient consideration for a promise if there is any benefit to the promisor or any detriment to the promisee. A benefit need not necessarily accrue to the promisor if a detriment to the promisee is present, and there is a consideration if the promisee does anything legal which he is not bound to do or refrains from doing anything which he has a right to do, whether or not there is any actual loss or detriment to him or actual benefit to the promisor. Omaha Nat. Bank v. Goddard Realty, Inc., 210 Neb. 604, 316 N.W.2d 306 (1982); Phelps v. Blome, 150 Neb. 547, 35 N.W.2d 93 (1948).
The amended petition simply alleged the execution of the last will and testament by Charles A. Blanchard was consideration for the execution of the contract. The defendant insists that her decedent got nothing more from the estate than she would have been entitled to had she renounced the will and elected to take her statutory share. The fact remains, however, that she did not choose to do so.
As the plaintiff argues in his brief, his father executed the will in favor of Mildred, appointing her as executrix, for which services she was entitled to and did receive a fee, and that the father preserved his estate intact and left his will unchanged and unrevoked until his death, even though he was not legally bound to do so. The general demurrer admits all facts and reasonable inferences to be drawn from facts properly pleaded.
Also, in an action on contract, the absence of consideration is an affirmative defense to be set out in the answer, see Erftmier v. Eickhoff, 210 Neb. 726, 316 N.W.2d 754 (1982), and the issue of consideration should not be the subject of a demurrer.
In reviewing the motion to strike certain language within the initial petition, Neb. *711 Rev.Stat. § 25-833 (Reissue 1979) provides in part: "If redundant, scandalous or irrelevant matter be inserted in any pleading, it may be stricken out on motion of the party prejudiced thereby...."
In State ex rel. Beck v. Associates Discount Corp., 162 Neb. 683, 696, 77 N.W.2d 215, 224 (1956), this court stated: "`Matter is irrelevant in a pleading which has no bearing upon the subject matter of the controversy, and cannot affect the decision of the court....'"
The stricken allegations of the plaintiff's petition relate to two joint tenancy accounts owned by Charles and Mildred Blanchard. We believe the trial court was correct to sustain the motion to strike, because the joint accounts are separate from the probate property received by Mildred, and separate from the property referred to in the memorandum which the plaintiff seeks to enforce. Also, the joint accounts are not referred to as consideration in the pleadings, although the plaintiff now contends the accounts might be considered sufficient consideration.
The action of the district court in sustaining the general demurrer of the defendant and dismissing the plaintiff's amended petition was erroneous. The judgment of the district court is reversed, and the cause is remanded for further proceedings.
REVERSED AND REMANDED FOR FURTHER PROCEEDINGS.
GRANT, J., disqualified.
