hidl_version: Add comparison operators

Test: libhidl_test passes
Change-Id: I8bb01599ae581484d80014bd99c4aff09a953824
diff --git a/base/include/hidl/HidlSupport.h b/base/include/hidl/HidlSupport.h
index 8bdb5fe..0670dd9 100644
--- a/base/include/hidl/HidlSupport.h
+++ b/base/include/hidl/HidlSupport.h
@@ -703,6 +703,23 @@
         return (mMajor == other.get_major() && mMinor == other.get_minor());
     }
 
+    bool operator<(const hidl_version& other) const {
+        return (mMajor < other.get_major() ||
+                (mMajor == other.get_major() && mMinor < other.get_minor()));
+    }
+
+    bool operator>(const hidl_version& other) const {
+        return other < *this;
+    }
+
+    bool operator<=(const hidl_version& other) const {
+        return !(*this > other);
+    }
+
+    bool operator>=(const hidl_version& other) const {
+        return !(*this < other);
+    }
+
     constexpr uint16_t get_major() const { return mMajor; }
     constexpr uint16_t get_minor() const { return mMinor; }
 
@@ -798,4 +815,3 @@
 
 
 #endif  // ANDROID_HIDL_SUPPORT_H
-