Add equality operators to RefCountedPtr.
diff --git a/src/core/lib/support/ref_counted_ptr.h b/src/core/lib/support/ref_counted_ptr.h
index dc2385e..83e99d8 100644
--- a/src/core/lib/support/ref_counted_ptr.h
+++ b/src/core/lib/support/ref_counted_ptr.h
@@ -76,6 +76,19 @@
   T& operator*() const { return *value_; }
   T* operator->() const { return value_; }
 
+  bool operator==(const RefCountedPtr& other) const {
+    return value_ == other.value_;
+  }
+  bool operator==(T* other) const {
+    return value_ == other;
+  }
+  bool operator!=(const RefCountedPtr& other) const {
+    return value_ != other.value_;
+  }
+  bool operator!=(T* other) const {
+    return value_ != other;
+  }
+
  private:
   T* value_ = nullptr;
 };
diff --git a/test/core/support/ref_counted_ptr_test.cc b/test/core/support/ref_counted_ptr_test.cc
index 1830edc..ce4975d 100644
--- a/test/core/support/ref_counted_ptr_test.cc
+++ b/test/core/support/ref_counted_ptr_test.cc
@@ -138,6 +138,19 @@
   foo_ref.value();
 }
 
+TEST(RefCountedPtr, EqualityOperators) {
+  RefCountedPtr<Foo> foo(New<Foo>());
+  RefCountedPtr<Foo> bar = foo;
+  RefCountedPtr<Foo> empty;
+  // Test equality between RefCountedPtrs.
+  EXPECT_EQ(foo, bar);
+  EXPECT_NE(foo, empty);
+  // Test equality with bare pointers.
+  EXPECT_EQ(foo, foo.get());
+  EXPECT_EQ(empty, nullptr);
+  EXPECT_NE(foo, nullptr);
+}
+
 TEST(MakeRefCounted, NoArgs) {
   RefCountedPtr<Foo> foo = MakeRefCounted<Foo>();
   EXPECT_EQ(0, foo->value());