  United States Court of Appeals
      for the Federal Circuit
                ______________________

     FUTUREWEI TECHNOLOGIES, INC., AND
         HUAWEI DEVICE USA, INC.,
            Plaintiffs-Appellants,

                          v.

       ACACIA RESEARCH CORPORATION,
               Defendant-Appellee,

                         AND

                 ACCESS CO., LTD.,
                  Defendant-Appellee,

                         AND

      SMARTPHONE TECHNOLOGIES, LLC,
              Defendant-Appellee.
            ______________________

                      2013-1090
                ______________________

   Appeal from the United States District Court for the
Central District of California in No. 12-CV-0511, Judge
Andrew J. Guildford.
                 ______________________

              Decided: December 3, 2013
               ______________________
2   FUTUREWEI TECHNOLOGIES, INC.   v. ACACIA RESEARCH CORP.



    GREGORY A. CASTANIAS, Jones Day, of Washington,
DC, argued for plaintiffs-appellants. With him on the
brief was RAJEEV MUTTREJA, of New York, New York.

    BENJAMIN R. ASKEW, The Simon Law Firm, P.C., of
Saint Louis, Missouri, argued for all defendants-
appellees. With him on the brief for Smartphone Tech-
nologies, LLC, were ANTHONY G. SIMON and STEPHANIE H.
TO. On the brief for Acacia were MARC J. SCHNEIDER,
STEPHEN L. RAM, DOUGLAS Q. HAHN, and MATTHEW T.
MONTGOMERY, Stradling Yocca Carlson & Rauth, P.C., of
Newport Beach, California. On the brief for Access Co.,
Ltd., were and SHARON L. O’GRADY and BRUCE A.
ERICSON, Pillsbury Winthrop Shaw Pittman, LLP, of San
Francisco, California.
                  ______________________

    Before REYNA, MAYER, and TARANTO, Circuit Judges.
TARANTO, Circuit Judge.
    Huawei Device USA Inc. and Futurewei Technologies,
Inc. (collectively, “Huawei”) appeal a district court’s
dismissal of their complaint. We affirm.
                      BACKGROUND
    Access Co., Ltd., which sells software for mobile com-
munication devices, owns the five patents at issue in this
appeal (“the five patents”). On July 31, 2009, Access
entered into an exclusive license agreement with Acacia
Patent Acquisition LLC (“APAC”), a wholly owned subsid-
iary of Acacia Research Corporation. The agreement
gives APAC “the exclusive right to grant sublicenses, to
sue for and collect past, present and future damages and
to seek to obtain injunctive or any other relief for in-
fringement of” specified patents.
    Section 11.3 of the agreement broadly disclaims the
creation of any third-party-beneficiary rights:
FUTUREWEI TECHNOLOGIES, INC.   v. ACACIA RESEARCH CORP.    3



    Nothing in this agreement, whether express or
    implied, shall be construed to give any person
    (other than the Parties and their respective per-
    mitted successors and assigns), any legal or equi-
    table right, remedy or claim under or in respect of
    this Agreement or any covenants, conditions or
    provisions contained herein, as a third party bene-
    ficiary or otherwise.
The agreement contains two other provisions relevant to
the present case. Section 2.1 states that APAC may not
enforce the covered patents against, or seek licenses to
practice the patents from, Access’s customers and end-
users in connection with Access’s products and services.
Section 9.1 states that “APAC and [Access] each irrevoca-
bly consent to the exclusive jurisdiction of any California
state or federal court sitting in the Central District of
California, over any suit, action or proceeding arising out
of or relating to this Agreement.” Those provisions re-
main in the agreement despite other amendments.
    On December 14, 2009, APAC assigned all of its
rights, obligations, interests, and liabilities in identified
patents covered by the license agreement to a wholly
owned subsidiary, SmartPhone Technologies LLC. The
license agreement as amended and the assignment cover
the five patents.
     On April 3, 2012, SmartPhone sued Huawei, which
makes mobile handsets and tablets, in the Eastern Dis-
trict of Texas, alleging that certain Huawei products
infringe the five patents. Compl. for Patent Infringement,
SmartPhone Tech. LLC v. Huawei Tech. Co. et al., No.
6:12-cv-245 (E.D. Tex. Apr. 2, 2012), ECF No. 1. The next
day, April 4, 2012, Huawei brought the present action
against SmartPhone, Acacia Research, and Access in the
Central District of California. The operative complaint
(the second amended complaint) alleges that Huawei has
been an Access customer for more than ten years and has
4   FUTUREWEI TECHNOLOGIES, INC.   v. ACACIA RESEARCH CORP.



contracted with Access to “purchase[] Access products,
including software for use on certain models of Huawei’s
mobile handsets.”
    Counts 1-5 of the complaint seek declaratory judg-
ments of noninfringement of the five patents, and counts
6-10 seek declaratory judgments of invalidity of the same
patents. Count 11 is entitled “Enforcement of Rights as a
Third-Party Beneficiary,” but neither count 11 nor the
prayer for relief expressly asks for a declaratory judgment
that Huawei has that status. Rather, based on section
2.1’s protection of Access’s customers, count 11 alleges
that the parties to the agreement intended Huawei to
benefit from the agreement, that SmartPhone is bound by
section 2.1 as assignee, and that there is “an actual and
justiciable controversy . . . concerning the rights of
Huawei as a third-party beneficiary.” Counts 12-15 of the
complaint seek to impose tort liability under California
law for interference with contractual and economic rela-
tions and for unfair competition. Count 16, when read
with the prayer for relief, seeks a declaratory judgment
that Acacia Research and SmartPhone are acting as
corporate alter egos.
    SmartPhone, Acacia Research, and Access moved to
dismiss Huawei’s complaint. On October 22, 2012, the
district court granted their motions. Futurewei Techs.,
Inc. v. Acacia Research Corp., No. SACV 12-0511, Slip.
Op. (C.D. Cal. Oct. 22, 2012), ECF No. 69. Based on the
infringement action filed against Huawei in Texas before
Huawei responded with the present declaratory-judgment
action, the district court dismissed the noninfringement
and invalidity counts (1-10) under the first-to-file rule,
which “permits a district court to decline jurisdiction
when a complaint involving substantially similar parties
and issues has already been filed in another district
court.” Id. at 4. The court added that “[t]he general rule
that the first-filed case is favored over the second-filed
action may be even stronger where the second-filed action
FUTUREWEI TECHNOLOGIES, INC.   v. ACACIA RESEARCH CORP.    5



is [for] a declaratory judgment.” Id. at 5. The court
explained that “the subject matter in the second case is
either the infringement or validity of the patents asserted
in the first action or the fact that SmartPhone attempted
to assert those patents against [Huawei] in Texas.” Id. at
6-7.
    The district court dismissed count 11 for failure to
state a claim. Noting Huawei’s “conclusory allegation”
that the parties to the license agreement intended
Huawei to benefit from it, the court explained that the
agreement, which was attached to the complaint, must
prevail over a general allegation where they conflict. Id.
at 10 (relying on Sprewell v. Golden State Warriors, 266
F.3d 979, 988 (9th Cir. 2001), and Northern Ind. Gun &
Outdoor Shows, Inc. v. City of South Bend, 163 F.3d 449,
454 (7th Cir. 1999)). Here, the court concluded, section
11.3 of the license agreement “clearly expresses the
contracting parties’ intention that the license not create
any third-party beneficiaries.” Id. at 10.
    The district court then dismissed counts 12-15 and,
for separate reasons, count 16. As to count 16, which
seeks a declaration that SmartPhone and Acacia Research
are alter egos, the court reasoned that, under Federal
Rule of Civil Procedure 13(a), this count is a compulsory
counterclaim to the claims in the Texas case and therefore
must be brought in that case. Id. at 13. The court noted
that the parties contested whether a cause of action even
exists to seek a freestanding declaratory judgment of
alter-ego status. Id.
    Having dismissed all of Huawei’s claims, the district
court denied Huawei’s request for discovery to help estab-
lish jurisdiction, explaining that discovery “would not
affect the Court’s reasoning regarding the first-to-file rule
or Plaintiffs’ failure to state a claim, and would thus be
futile.” Id. at 13. And the court denied Huawei’s request
for leave to file a third amended complaint, explaining
6   FUTUREWEI TECHNOLOGIES, INC.   v. ACACIA RESEARCH CORP.



that Huawei “‘could not possibly cure the deficien[cies]’” of
the dismissed complaint. Id.
   Huawei appeals.       We have jurisdiction under 28
U.S.C. § 1295(a)(1).
                        DISCUSSION
    Huawei appeals the district court’s dismissal of counts
11 and 16 of the complaint. We affirm the dismissal of
those counts, but we rely on the first-to-file rule, conclud-
ing that, like counts 1-10, counts 11 and 16 both belong in
the Eastern District of Texas. The district court did not
rely on this ground for counts 11 and 16, but in the cir-
cumstances here, we are not precluded from doing so.
    Huawei suffers no prejudice from our relying on this
ground, and appellees have embraced it as a substitute
basis for dismissal. If there is any change in the scope of
relief, it is only to provide appellees somewhat less relief.
Moreover, the district court did not reject this ground for
counts 11 and 16, and our analysis simply applies to
counts 11 and 16 the first-to-file conclusion that the
district court itself drew, “at a minimum,” for counts 1-10.
Futurewei Techs., No. SACV 12-0511, Slip. Op. at 9. We
rely on an alternative ground that is supported by the
record and that is consistent with the district court’s own
reasoning.
    When two actions that sufficiently overlap are filed in
different federal district courts, one for infringement and
the other for declaratory relief, the declaratory judgment
action, if filed later, generally is to be stayed, dismissed,
or transferred to the forum of the infringement action.
Merial Ltd. v. Cipla Ltd., 681 F.3d 1283, 1299 (Fed. Cir.
2012). This “first-to-file” rule exists to “avoid conflicting
decisions and promote judicial efficiency.” Id. But the
rule is not absolute; exceptions may be made if justified
by “considerations of judicial and litigant economy, and
the just and effective disposition of disputes.” Elecs. for
FUTUREWEI TECHNOLOGIES, INC.      v. ACACIA RESEARCH CORP.   7



Imaging, Inc. v. Coyle, 394 F.3d 1341, 1347 (Fed. Cir.
2005) (internal quotation marks omitted). Justification
for an exception may be found in “the convenience and
availability of witnesses, [the] absence of jurisdiction over
all necessary or desirable parties, . . . the possibility of
consolidation with related litigation, or considerations
relating to the real party in interest.” Genentech, Inc. v.
Eli Lilly & Co., 998 F.2d 931, 938 (Fed. Cir. 1993). Reso-
lution of whether the second-filed action should proceed
presents a question sufficiently tied to patent law that the
question is governed by this circuit’s law. Elecs. for
Imaging, 394 F.3d at 1345-46. Application of the first-to-
file rule is generally a matter for a district court’s discre-
tion, exercised within governing legal constraints. See
Martin v. Franklin Capital Corp., 546 U.S. 132, 139
(2005); Merial, 681 F.3d at 1299.
                              A
    It is not disputed that the district court properly in-
voked the first-to-file rule to dismiss counts 1-10, which
request declaratory judgments of non-infringement and
invalidity of the five patents already in litigation in
Texas. The analysis that supported that result applies as
well to count 11. We assume, for present purposes, that
count 11 requests some relief, namely, a declaratory
judgment that Huawei is a third-party beneficiary of the
license agreement entitled to enforce its provisions. We
have no doubt that it would be both just and efficient to
have Huawei’s third-party-beneficiary status litigated, if
necessary, in Texas. See Genentech, 998 F.2d at 938.
     Third-party-beneficiary status benefits Huawei not for
its own sake but only instrumentally—to give it the right
to enforce certain contract provisions. Here, Huawei has
said that its status as a third-party beneficiary can mat-
ter for two purposes: to invoke the license agreement’s
section 2.1 to protect it against the allegations it is in-
fringing the five patents; and to invoke the agreement’s
8   FUTUREWEI TECHNOLOGIES, INC.   v. ACACIA RESEARCH CORP.



section 9.1, regarding forum selection. Those provisions
of the license agreement are already at issue in the first-
filed Texas action, or readily could be. In that action,
Huawei has raised an affirmative defense that, as an
Access customer, it is “licensed and/or impliedly licensed
to practice the asserted patents.” Defendants’ Answer,
Counterclaims, and Third-Party Compl., No. 6:12-cv-245
(Nov. 9, 2012), ECF No. 80. It also has moved to transfer
the Texas case. Id., ECF No. 75 (Nov. 2, 2012). Huawei
can litigate its status as a third-party beneficiary in
support of its positions in that action. 1
    It may be that Huawei can secure protection against
or transfer of the Texas suit without having to establish
that it has the legal status of a third-party beneficiary of
the agreement.      For example, section 2.1 may give
Huawei a license for the challenged activities, and trans-
fer may be required or warranted based in whole or in
part on the forum-selection clause or based on the more



    1    On November 12, 2013, the magistrate judge in
the Texas case denied Huawei’s motion to transfer. With
reconsideration and review possible, that ruling presuma-
bly does not conclusively settle the transfer question in
the Texas case. We note particularly that, given appel-
lees’ embrace of a first-to-file dismissal as a substitute
ground of affirmance here and the first-to-file rule’s
rationale that the Texas court rather than the California
court should decide the merits of the issues presented by
counts 11 and 16, the California court’s rationales for
dismissing those counts cannot be regarded as binding
against Huawei; those issues are open for fresh considera-
tion in the Texas case if necessary. We do not regard it as
necessary to vacate the California court’s rulings on those
counts and order dismissal on the first-to-file ground, but
our affirmance of the judgment on the first-to-file ground
has the same effect.
FUTUREWEI TECHNOLOGIES, INC.    v. ACACIA RESEARCH CORP.     9



multi-factored approach that generally governs change of
venue. See In re Atl. Marine Constr. Co., 701 F.3d 736
(5th Cir. 2012), cert. granted, 133 S. Ct. 1748 (2013); In re
Broadcom Corp., MISC 141, 2013 WL 1736487 (Fed. Cir.
Apr. 23, 2013) (unpublished opinion, discussing Atlantic
Marine). 2 Those possibilities may make it unnecessary
for Huawei’s status as a third-party beneficiary to be
decided in the Texas case, but there is no doubt that
Huawei can argue for that status in the Texas case. And
there is likewise no doubt that keeping the issue in the
Texas case will serve key objectives of the first-to-file rule,
including minimization or avoidance of “duplication of
effort, waste of judicial resources, and risk of inconsistent
rulings that would accompany parallel litigation.” Fu-
turewei Techs., No. SACV 12-0511, Slip Op. at 9.
    Finding an exception to the first-to-file rule here is
unsupported by any substantial countervailing considera-
tions. Huawei has not shown that judicial or litigant
interests in economy favor allowing count 11 to proceed in
this second-filed declaratory-judgment action. Indeed,
Huawei is a Texas corporation and has its principal place
of business in Texas. At this point, moreover, with the
dismissal of counts 1-10 no longer disputed, the non-
infringement and invalidity issues will be litigated in the
Texas case, unless that case is transferred. Separating
the third-party-beneficiary issue cannot serve the objec-
tive of efficiency.
    The interest in the just and effective disposition of
disputes likewise does not warrant an exception to the


    2    The Supreme Court, in Atlantic Marine, is cur-
rently addressing the significance of forum-selection
clauses in deciding whether a case should remain in a
plaintiff-selected forum. The analysis here does not
depend on the Supreme Court’s disposition in the Atlantic
Marine case.
10 FUTUREWEI TECHNOLOGIES, INC. v. ACACIA RESEARCH CORP.



first-to-file rule. The Texas court can decide the issues
presented by count 11, if necessary, including the rela-
tionship between the no-third-party-beneficiary rights
provision of the license agreement and either (a) the
enforcement-protection provision or (b) the forum-
selection provision. Those issues may raise questions of
California law, such as whether (as the parties suggested
to this court during oral argument) status as a third-party
beneficiary is not always all or nothing: where a contract
broadly disclaims third-party-beneficiary rights, but
another provision conferring particular benefits meets the
standard for such rights, perhaps third-party-beneficiary
status is limited to that provision. See, e.g., Prouty v.
Gores Tech. Group, 18 Cal. Rptr. 3d 178, 184 (Cal. App. 3d
Dist. 2004) (finding that where two companies included a
specific provision granting rights to one company’s em-
ployees that “expressly benefit[ted] them, and only them,”
this specific provision was an exception to the contract’s
general no-third-party beneficiaries provision); cf. Re-
statement (Second) of Contracts § 302 (1981) (likewise
appearing to tie third-party beneficiaries’ rights to partic-
ular promises). Such questions may not have to be an-
swered, but if they do, the Texas court can answer them.
Choice of law may affect a transfer analysis, but the
possibility of having to decide a California-law question is
not enough, in the present posture of this case, to support
an exception to the first-to-file rule.
                             B
     The same conclusion follows for count 16, which seeks
a declaratory judgment that SmartPhone is acting as
Acacia Research’s alter ego. That count also is directly
related to Huawei’s affirmative defense in the Texas
litigation that it has rights to practice the five patents
under the license agreement between Access and Acacia
Research’s wholly owned subsidiary APAC. It makes no
sense for this count to be adjudicated as a stand-alone
claim in California while the relevant, substantive claims
FUTUREWEI TECHNOLOGIES, INC.    v. ACACIA RESEARCH CORP. 11



to which it directly relates are being litigated in Texas.
Indeed, SmartPhone’s status as an alter ego to Acacia
Research matters only insofar as it affects substantive
rights found elsewhere—here, the rights being litigated in
Texas. Cf. Ahcom, Ltd. v. Smeding, 623 F.3d 1248, 1251
(9th Cir. 2010) (explaining that, under California law,
“there is no such thing as a substantive alter ego claim at
all”); Hennessy’s Tavern, Inc. v. Am. Air Filter Co., 204
Cal. App. 3d 1351, 1359 (Cal. Ct. App. 1988) (“A claim
against a defendant, based on the alter ego theory, is not
itself a claim for substantive relief, e.g., breach of contract
or to set aside a fraudulent conveyance, but rather, proce-
dural, i.e., to disregard the corporate entity as a distinct
defendant and to hold the alter ego individuals liable on
the obligations of the corporation. . . .”).
      Although we rely on the first-to-file rule in affirming
dismissal of count 16, our conclusion is indirectly support-
ed by the district court’s conclusion that count 16 is a
compulsory counterclaim under Federal Rule of Civil
Procedure 13. The Ninth Circuit applies a “the logical
relationship test” to determine whether or not a claim is
compulsory. In re Pegasus Gold Corp., 394 F.3d 1189,
1195-96 (9th Cir. 2005).         “This flexible approach
. . . attempts to analyze whether the essential facts of the
various claims are so logically connected that considera-
tions of judicial economy and fairness dictate that all the
issues be resolved in one lawsuit.” Pochiro v. Prudential
Ins. Co. of Am., 827 F.2d 1246, 1249 (9th Cir. 1987) (in-
ternal quotation marks omitted).
    A logical relationship exists when the counter-
    claim arises from the same aggregate set of opera-
    tive facts as the initial claim, in that the same
    operative facts serve as the basis of both claims or
    the aggregate core of facts upon which the claim
    rests activates additional legal rights otherwise
    dormant in the defendant.
12 FUTUREWEI TECHNOLOGIES, INC. v. ACACIA RESEARCH CORP.



Pegasus Gold, 394 F.3d at 1196. Here, the logical rela-
tionship is strong: the license agreement gives rise to
Huawei’s alter-ego claim, to SmartPhone’s affirmative
right to enforce the patents in the Texas case, and to
Huawei’s defense in that case that it may practice the
patents as an Access customer—a defense that undergirds
Huawei’s standing to seek a declaratory judgment on the
alter-ego issue in the first place. Rule 13 analysis thus
bolsters the first-to-file conclusion here.
                           C
    Because counts 11 and 16 are properly dismissed un-
der the first-to-file rule, we need not address Huawei’s
motion to amend its complaint and its request for addi-
tional discovery to establish jurisdiction.
                      AFFIRMED
