                  FOR PUBLICATION
  UNITED STATES COURT OF APPEALS
       FOR THE NINTH CIRCUIT

In re: ADBOX, INC.,                    
                            Debtor,


DONALD I. METCALF, an individual;
JANET M. METCALF, an individual,             No. 05-55158
                      Appellants,
                                              D.C. No.
                                           CV-04-00686-LGB
                 v.
JEFFREY I. GOLDEN, Chapter 7                  OPINION
Trustee, in his capacity as Chapter
7 Trustee for the Estate of Adbox,
Inc.,
                           Appellee.
                                       
        Appeal from the United States District Court
           for the Central District of California
        Lourdes G. Baird, District Judge, Presiding

                 Argued and Submitted
           March 8, 2007—Pasadena, California

                      Filed June 4, 2007

  Before: Pamela Ann Rymer, Kim McLane Wardlaw, and
            Milan D. Smith, Jr., Circuit Judges.

           Opinion by Judge Milan D. Smith, Jr.




                            6673
                       IN RE ADBOX, INC.                  6677


                         COUNSEL

James A. Shalvoy, Manhattan Beach, California, for the
defendant-appellants.

Kathleen M. Goldberg, The Law Office of Thomas H. Casey,
Inc., Rancho Santa Margarita, California, for the plaintiff-
appellee.


                         OPINION

MILAN D. SMITH, JR., Circuit Judge:

   Appellants Donald and Janet Metcalf were the primary
financial backers of a start-up company named Adbox, Inc. In
1998, the Metcalfs agreed to sell their interest in Adbox to
Christer Wernerdal, but Wernerdal soon failed to make pay-
ments required by the sales agreements. Wernerdal brought a
lawsuit against the Metcalfs and later took Adbox into bank-
ruptcy. The bankruptcy trustee initiated a preference action to
recover a $21,035.58 payment from Adbox to the Metcalfs,
and the Metcalfs filed a counterclaim against the trustee. The
Metcalfs argued that the counterclaim was against a proper
“opposing party” and that the disputed funds they received
were “earmarked” and therefore not part of the bankruptcy
estate. The Metcalfs appeal the district court’s affirmance of
the bankruptcy court’s dismissal of the counterclaim and its
grant of summary judgment to the trustee in the preference
action. We affirm.
6678                   IN RE ADBOX, INC.
          FACTS AND PRIOR PROCEEDINGS

   The Metcalfs and Wernerdal formed Adbox in 1992. The
Metcalfs agreed to pay the company’s expenses until it
became self-sufficient, and Wernerdal agreed to run the busi-
ness as a salaried employee. The Metcalfs and Wernerdal
jointly operated the business under this arrangement until
1998, when they decided to separate. The parties agreed that
Wernerdal would become the sole owner of Adbox and that
the Metcalfs would receive $315,139.36—$200,000.00 as the
purchase price for their interest in Adbox, and $115,139.36
for the performance of certain consulting services.

   Wernerdal then took control of Adbox, but instead of pay-
ing the Metcalfs the full amount due under their agreements,
Wernerdal and Adbox sued the Metcalfs in Los Angeles
Superior Court alleging usury and seeking a declaratory judg-
ment that the consulting agreement was unenforceable. After
a two-week bench trial, the court found that the consulting
agreement was valid and enforceable, but that it only entitled
the Metcalfs to $97,476.36, rather than the $115,139.36 origi-
nally claimed. The court also found unenforceable the provi-
sion of the agreement entitling the Metcalfs to attorney’s fees
as the “prevailing party” in the litigation. Wernerdal paid the
Metcalfs the $200,000.00 purchase price during the course of
the litigation, and Adbox paid the required $97,476.36 after
the trial court’s ruling. All parties appealed.

   In May 2002, the state appellate court reversed the trial
court on the amount due—requiring Adbox to pay the full
$115,139.36 originally claimed—found the attorney’s fees
provision enforceable, and remanded for a determination of
fees and costs. On remand, the trial court ordered Adbox to
pay the Metcalfs $612,684.00 in attorney’s fees and costs.

  Adbox did not have sufficient funds to pay the difference
between the original and modified judgment—$21,035.58
with interest—or to pay the attorney’s fees owed. About that
                       IN RE ADBOX, INC.                    6679
time, Wernerdal sought an $18,000.00 loan from Ulf Ernetoft
of Accenta Display Corporation, a Canadian company inter-
ested in Adbox’s business. Accenta agreed to make the
requested loan and deposited $18,000.00 in Wernerdal’s per-
sonal account on June 24, 2002. Two days later, Robin
Whitburn—Wernerdal’s wife—deposited the $18,000.00 in
Adbox’s general account. Also on June 26, 2002, Accenta
made a separate payment of $19,500.00 to Adbox.

   On June 28, 2002, Adbox paid its court-determined debt to
the Metcalfs in a series of transactions. Specifically, it wired
$21,035.58 (the precise amount outstanding under the con-
sulting agreement) to its attorney who, in turn, sent the same
amount to the Metcalfs along with a letter explaining that the
money was in satisfaction of the “decision of the court of
appeals, including the amount of $17,663.00, plus interest.”
Adbox did not, however, pay the attorney’s fees award.

   On September 6, 2002—less than 90 days after the
$21,035.58 payment to the Metcalfs—Wernerdal caused
Adbox to file for bankruptcy under Chapter 7 of the Bank-
ruptcy Code in the Central District of California. Appellee
Jeffrey I. Golden was appointed trustee of the Adbox bank-
ruptcy estate. In his capacity as trustee, Golden filed a prefer-
ence action under 11 U.S.C. §§ 547 and 550(a)(1) to recover
the $21,035.58 that Adbox had paid to the Metcalfs. In
response, the Metcalfs filed a counterclaim against Golden
alleging that Adbox’s conduct prior to filing for bankruptcy
constituted tortious interference with prospective economic
advantage, violation of California Civil Code § 3439, and
conspiracy to do so. Golden moved to dismiss the counter-
claim and later moved for summary judgment in the prefer-
ence action. After a hearing on Golden’s motion to dismiss
the counterclaim, the bankruptcy court construed it as a
motion for summary judgment and granted it. After a separate
hearing on Golden’s motion for summary judgment in the
preference action, the bankruptcy court granted that motion as
well.
6680                    IN RE ADBOX, INC.
  The Metcalfs appealed to the district court, and the district
court affirmed both rulings. The Metcalfs timely appeal.

     JURISDICTION AND STANDARD OF REVIEW

   The district court had jurisdiction over the appeal from the
bankruptcy court under 28 U.S.C. § 158(a). We have jurisdic-
tion under 28 U.S.C. §§ 158(d) and 1291.

  We review the district court’s decision on appeal from a
bankruptcy court de novo, giving no deference to the district
judge’s determinations. In re Onecast Media, Inc., 439 F.3d
558, 561 (9th Cir. 2006). We review the bankruptcy court’s
grant of a motion to dismiss de novo. In re Hemmeter, 242
F.3d 1186, 1189 (9th Cir. 2001). We likewise review the grant
of a summary judgment de novo. In re Betacom of Phoenix,
Inc., 240 F.3d 823, 827-28 (9th Cir. 2001).

                        DISCUSSION

I.   Dismissal of the Counterclaim

   [1] Federal Rule of Bankruptcy Procedure 7013 and Fed-
eral Rule of Civil Procedure 13 govern the propriety of coun-
terclaims in a bankruptcy context. According to Rule 7013:

     Rule 13 . . . applies in adversary proceedings, except
     that a party sued by a trustee or debtor in possession
     need not state as a counterclaim any claim that the
     party has against the debtor, the debtor’s property, or
     the estate, unless the claim arose after the entry of an
     order for relief.

A counterclaim under Rule 13 must be against an “opposing
party.” Fed. R. Civ. P. 13(a), (b). Thus, a party sued by a
trustee may assert a counterclaim against that trustee, but only
if the trustee is an “opposing party” within the meaning of
Rule 13.
                        IN RE ADBOX, INC.                    6681
   [2] It is well-established that when a party sues in his repre-
sentative capacity, he is not subject to counterclaims against
him in his individual capacity. See Pioche Mines Consol., Inc.
v. Fidelity-Philadelphia Trust Co., 206 F.2d 336, 337 (9th
Cir.), cert. denied, 346 U.S. 899 (1953) (recognizing the “rule
that a counterclaim against a trustee in his individual capacity,
where he has sued as a fiduciary only, is not permissible inas-
much as it is not a counterclaim against an ‘opposing party,’
as contemplated by Rule 13”); see also 6 Charles Alan
Wright, Arthur R. Miller & Mary Kay Kane, Federal Practice
and Procedure § 1404 (2d ed. 1990); cf. Bender v. Williams-
port Area Sch. Dist., 475 U.S. 534, 543 n.6 (1986) (“Acts per-
formed by the same person in two different capacities are
generally treated as the transactions of two different legal per-
sonages.” (quoting F. James & G. Hazard, Civil Procedure
§ 11.6 (3d ed. 1985) (internal quotation marks omitted))).

   [3] The question presented here, however, is whether the
trustee is an “opposing party” when he has brought a prefer-
ence action that belongs to the bankruptcy estate and not to
the debtor, but the counterclaim alleges causes of action that
could have been brought against the debtor prior to its bank-
ruptcy filing. We hold that he is not. The Metcalfs styled their
counterclaim as against Golden “in his capacity as Chapter 7
trustee for the estate of Adbox,” but their allegations con-
cerned the conduct of Wernerdal and Adbox prior to Adbox’s
bankruptcy filing. While the Metcalfs presumably sought to
recover from Adbox’s assets in bankruptcy, the trustee would
have to stand in the shoes of the debtor to defend against the
counterclaim. This would be a representative capacity differ-
ent from the representative capacity in which a trustee brings
a preference action, because a preference action belongs spe-
cifically to the bankruptcy trustee and could not have been
brought by the debtor prior to its bankruptcy filing. Moreover,
if the Metcalfs’ allegations are correct, and Adbox did transfer
assets in order to shield them from its creditors, then it was
the trustee’s duty to represent the interests of all creditors to
the Adbox estate (including the Metcalfs’ interest) by recover-
6682                        IN RE ADBOX, INC.
ing those assets through a fraudulent transfer action under 11
U.S.C. § 548. In his § 547 preference action, however, the
trustee was not representing all of the creditors’ interests, but
rather the interests of all of the creditors other than the Met-
calfs. Therefore, under the allegations of the Metcalfs’ coun-
terclaim, the trustee was not an “opposing party” within the
meaning of Rule 13 and the counterclaim was properly dis-
missed.1

II. The Motion for Summary Judgment in the Prefer-
ence Action

   [4] Under 11 U.S.C. § 547 the bankruptcy trustee may
recover certain transfers made by the debtor within 90 days
before filing for bankruptcy, if the trustee proves:

      (1) a transfer of an interest of the debtor in prop-
      erty;

      (2)   to or for the benefit of a creditor;

      (3)   for or on account of an antecedent debt;

      (4)   made while the debtor was insolvent;

      (5) made on or within 90 days before the date of
      the filing of the petition; and

      (6) one that enables the creditor to receive more
      than such creditor would receive in a Chapter 7 liq-
      uidation of the estate.
  1
    We do not foreclose the possibility that under different circumstances,
Rule 7013 might permit a creditor to bypass the proof of claim process
provided by 11 U.S.C. §§ 501-02 and Rule 3001 via a counterclaim, but
in this case the district court correctly affirmed the bankruptcy court’s dis-
missal of the counterclaim for failure to satisfy the “opposing party”
requirement of Rule 13. See Collier on Bankruptcy § 7013.03 (Alan N.
Resnick & Henry J. Sommer eds., 15th ed. rev. 2006).
                       IN RE ADBOX, INC.                    6683
In re Superior Stamp & Coin Co., Inc., 223 F.3d 1004, 1007
(9th Cir. 2000) (citing 11 U.S.C. § 547(b)). Such a transfer is
known as an “avoidable preference” or a “preferential trans-
fer.” Id. at 1007-09. The “earmarking doctrine” is a court-
made exception to this rule that applies when a third party
advances funds to the debtor subject to an agreement requir-
ing the debtor to use the funds to pay off another creditor. Id.;
In re Sierra Steel, Inc., 96 B.R. 271, 274 (B.A.P. 9th Cir.
1989). In such circumstances, the funds are deemed “ear-
marked” and are not considered part the debtor’s estate.
Sierra Steel, 96 B.R. at 274.

  A.   Waiver of an Earmarking Defense

   [5] The trustee argues that the Metcalfs waived their ear-
marking defense entirely by failing to plead it as an affirma-
tive defense in their answer to the preference action
complaint. Federal Rule of Civil Procedure 8(a) and (c) pro-
vide that a defendant’s failure to raise an “affirmative
defense” in his answer effects a waiver of that defense. See
Morrison v. Mahoney, 399 F.3d 1042, 1046 (9th Cir. 2005);
5 Charles Alan Wright, Arthur R. Miller & Mary Kay Kane,
Federal Practice & Procedure § 1278 (2d ed. 1990). It is not
well-settled, however, whether earmarking is an affirmative
defense and therefore waived if not pled in the answer. We
have not directly addressed the issue and out-of-circuit cases
reach contrary conclusions. Compare In re Winstar
Comm’ns., Inc., 348 B.R. 234, 273 (Bankr. D. Del. 2005)
(earmarking is an affirmative defense and waived because not
pled in the answer), with In re Libby Int’l., Inc., 247 B.R. 463,
467 (B.A.P. 8th Cir. 2000) (“The earmarking doctrine is not
strictly an affirmative defense under Section 547(c),” but
rather “is derived from an element of the plaintiff’s proof
. . . .” ), and In re Int’l Ventures, Inc., 207 B.R. 618, 620
(Bankr. E.D. Ark. 1997) (“[T]he earmarking doctrine is not
required to be pleaded as an affirmative defense since it is an
element of the plaintiff’s proof rather than an affirmative
defense.”) (citations omitted).
6684                         IN RE ADBOX, INC.
   [6] The reasoning of the Eighth Circuit’s Bankruptcy
Appellate Panel in Libby International is persuasive, and we
adopt it here. Earmarking is not one of the affirmative
defenses enumerated in Rule 8, and we decline to construe it
as such under Rule 8’s residuary clause for “any other matter
constituting an avoidance or affirmative defense.”2 Properly
understood, the earmarking doctrine is not an affirmative
defense under Rule 8, but rather a challenge to the trustee’s
claim that particular funds are part of the bankruptcy estate
under 11 U.S.C. § 547. See Libby Int’l., 247 B.R. at 467.
Thus, the Metcalfs did not waive their earmarking defense by
failing to plead it in their answer in the preference action.

  B.      The Burden of Proof for an Earmarking Defense

   [7] As the district court noted, there is “substantial confu-
sion” over who bears the burden of proof on an earmarking
defense. The Ninth Circuit Bankruptcy Appellate Panel
addressed this question in Sierra Steel, where it denied an ear-
marking defense because the defendant “ha[d] not traced the
funds to money received by the debtor from [the lender].” 96
B.R. at 275. While the Sierra Steel court started from the gen-
eral principal that the trustee has the burden of establishing
that property is part of the bankruptcy estate, it also noted that
the funds in question were disbursed from the defendant’s
general account. Id. at 274 n.5. The source of the funds raised
the presumption that the funds were property of the bank-
ruptcy estate and the burden of proof accordingly shifted from
the trustee—to establish that the funds were part of the estate
  2
   Rule 8 lists the following as “affirmative defenses” that are waived if
not pled in the answer:
      accord and satisfaction, arbitration and award, assumption of risk,
      contributory negligence, discharge in bankruptcy, duress, estop-
      pel, failure of consideration, fraud, illegality, injury by fellow
      servant, laches, license, payment, release, res judicata, statute of
      frauds, statute of limitations, [and] waiver.
Fed. R. Civ. P. 8(c).
                            IN RE ADBOX, INC.                          6685
—to the defendant—to show that they were not. Id. (citing In
re Bullion Reserve of N. Am., 836 F.2d 1214, 1217 n.3 (9th
Cir. 1988)).3

   [8] We follow well-established law in holding that the
trustee bears the initial burden of establishing that a transfer
is an avoidable preference under § 547. See Sierra Steel, 96
B.R. at 274. If, however, the trustee establishes that the trans-
fer of the disputed funds was from one of the debtor’s
accounts over which the debtor ordinarily exercised total con-
trol, we follow the approach of Sierra Steel and find that the
trustee makes a preliminary showing of an avoidable transfer
“of an interest of the debtor” under § 547(b). The burden then
shifts to the defendant in the preference action to show that
the funds were earmarked.

  [9] In the present case, the Metcalfs assert an earmarking
defense regarding funds first deposited in Adbox’s general
account and then disbursed to the Metcalfs. Accordingly,
while Adbox bore the initial burden of proving that the funds
were part of the bankruptcy estate, that burden shifted to the
Metcalfs when the funds were deposited into Adbox’s general
account.
  3
    After Sierra Steel, the Ninth Circuit Bankruptcy Appellate Panel made
passing reference to this issue again in In re Lee, where it noted that “[i]f
[the defendant] were asserting an earmarking defense, it failed to meet its
burden to present evidence on such a theory.” 179 B.R. 149, 156 n.3
(B.A.P. 9th Cir. 1995) (citing Sierra Steel, 96 B.R. at 274-75). While we
acknowledge that In re Lee may be read to suggest that the defendant
always bears the initial burden of proof in an earmarking defense, we do
not believe such a reading is proper. In re Lee addressed earmarking only
as a hypothetical, and moreover, its statement only suggests that the defen-
dant in that case would have had the burden of proof on an earmarking
defense, not that all defendants always have it. We read In re Lee to be
entirely consistent with Sierra Steel and the law of this circuit, as
described above.
6686                   IN RE ADBOX, INC.
  C.   Merits of the Motion for Summary Judgment

   [10] We now turn to the merits of the motion for summary
judgment in the preference action. The earmarking doctrine
applies “when a third party lends money to a debtor for the
specific purpose of paying a selected creditor.” Superior
Stamp, 223 F.3d at 1008 (quoting In re Kemp Pac. Fisheries,
Inc., 16 F.3d 313, 316 (9th Cir. 1994)). In Superior Stamp, we
identified the key question for the applicability of earmarking:
“whether the debtor had the right to disburse the funds to
whomever it wished, or whether their disbursement was lim-
ited to a particular creditor or creditors under the agreement
with the new creditor.” Id. at 1009.

   [11] Under Superior Stamp, the Metcalfs’ claim fails
because they have not raised a genuine issue as to whether the
lender (Accenta/Ernetoft) and debtor (Adbox/Wernerdal)
agreed that the loan must be used to pay the antecedent debt
to the Metcalfs. Because the loaned funds traced to Adbox’s
general account, the burden to establishing earmarking shifted
to the Metcalfs, and the Metcalfs admit that there is no direct
evidence of any agreement with the lender requiring that the
funds be used to satisfy the debt to them.

   [12] The Metcalfs argue, however, that the existence of
such an agreement may be inferred from the surrounding fac-
tual circumstances. In support of this assertion, the Metcalfs
cite Ernetoft’s testimony that “Christer [Wernerdal] came to
me and he needed . . . some money. I think it was for paying
Mr. Metcalf,” that Adbox needed the loan because “they had
this [sic] $22,000 as they said they will use to pay off Mr.
Metcalf,” and that it was his understanding that Whitburn
used the loan proceeds “to pay the amount that was owing
[sic] to Mr. Metcalf.” However, the Metcalfs identify no evi-
dence that the loan was in any way conditioned on its being
used to pay the debt to them; no direct evidence of any agree-
ment between Ernetoft, Wernerdal, or Whitburn that the funds
be so used; and no evidence that Wernerdal’s (and Adbox’s)
                       IN RE ADBOX, INC.                  6687
use of and control over the funds was in any way constrained.
Because the Metcalfs bore the burden of proof on their ear-
marking defense, it was their burden at the summary judg-
ment stage to identify “specific facts showing that there is a
genuine issue for trial.” Celotex Corp. v. Catrett, 477 U.S.
317, 324 (1986) (internal quotation marks omitted). The Met-
calfs have not met this burden, and the district court properly
affirmed the grant of summary judgment in the trustee’s
favor.

                      CONCLUSION

   For the foregoing reasons, we affirm the district court’s
affirmance of the bankruptcy court’s (a) dismissal of the
counterclaim and (b) its grant of summary judgment in favor
of the trustee in the preference action.

  AFFIRMED.
